Faster fix-permissions.sh

It takes a considerable amount of time to run but there's no need for
it.
This commit is contained in:
Aleix Pol
2026-05-07 15:10:30 +02:00
committed by Aleix Pol i Gonzalez
parent 9c3e4f93f2
commit d1c5fbb89c

View File

@@ -3,23 +3,15 @@
# SPDX-FileCopyrightText: 2024 Harald Sitter <sitter@kde.org>
# SPDX-FileCopyrightText: 2024 Bruno Pajdek <brupaj@proton.me>
# Something in GitLab causes bogus permissions to be set for mkosi stuff,
# reset them to something sane.
# Something in GitLab causes bogus permissions to be set for mkosi input
# trees, reset them to something sane.
#
# Only touch the source directories mkosi consumes directly. In particular,
# do not recurse into generated trees such as a stale mkosi.output because
# that can make this step unexpectedly expensive.
# Enable ** for recursive globbing and include hidden files when doing so.
shopt -s globstar dotglob
DIRS="mkosi.conf.d mkosi.extra mkosi.finalize.d mkosi.repart mkosi.sandbox mkosi.skeleton"
# Loop through all mkosi files.
for FILE in mkosi.*/**/*; do
# Skip symlinks.
if [ -L "$FILE" ]; then
continue
fi
# If the file is executable, reset permissions to 755, else to 644.
if [ -x "$FILE" ]; then
chmod 755 "$FILE"
else
chmod 644 "$FILE"
fi
done
find $DIRS -type d -exec chmod 755 {} +
find $DIRS -type f -perm /111 -exec chmod 755 {} +
find $DIRS -type f ! -perm /111 -exec chmod 644 {} +