添加 07_fix_permissions.sh

Signed-off-by: zhao <zhao@noreply.localhost>
This commit is contained in:
zhao 2025-04-14 11:36:45 +08:00
parent ef0c53e829
commit b24ab9b30f

32
07_fix_permissions.sh Normal file
View File

@ -0,0 +1,32 @@
#!/bin/bash
# Set base directory to the current directory
BASE_DIR=$(pwd)
# Setting permissions for directories, excluding staging_dir
find "$BASE_DIR" -path "$BASE_DIR/staging_dir" -prune -o -type d -exec chmod 755 "{}" +
# Setting permissions for files, excluding staging_dir
find "$BASE_DIR" -path "$BASE_DIR/staging_dir" -prune -o -type f -exec chmod 644 "{}" +
#find "$BASE_DIR" -path "$BASE_DIR/staging_dir" -prune -o -type f ! -name "*.c" ! -name "*.h" -exec dos2unix "{}" +
# Setting executable permissions for specific scripts, excluding staging_dir
find "$BASE_DIR" -path "$BASE_DIR/staging_dir" -prune -o -type f \( -name "*.sh" -o -name "*.pl" -o -name "*.py" -o -name "*.awk" -o -name "*bin*" -o -name "Makefile" -o -name "configure" \) -exec chmod 755 "{}" +
# Setting executable permissions for scripts in scripts directory, excluding staging_dir
find "$BASE_DIR/scripts" -path "$BASE_DIR/staging_dir" -prune -o -type f -exec chmod 755 "{}" +
# Setting special permissions for feeds, excluding staging_dir
find "$BASE_DIR/feeds" -path "$BASE_DIR/staging_dir" -prune -o -type f -exec chmod 755 "{}" +
# Setting executable permissions for init scripts in package, excluding staging_dir
find "$BASE_DIR" -path "$BASE_DIR/staging_dir" -prune -o -type f -exec grep -l 'config' "{}" + -exec chmod 644 "{}" +
find "$BASE_DIR" -path "$BASE_DIR/staging_dir" -prune -o -type f -exec grep -l 'bin' "{}" + -exec chmod 755 "{}" +
find "$BASE_DIR" -path "$BASE_DIR/staging_dir" -prune -o -type f -exec grep -l 'PKG' "{}" + -exec chmod 755 "{}" +
find "$BASE_DIR" -path "$BASE_DIR/staging_dir" -prune -o -type f -exec grep -l 'uci' "{}" + -exec chmod 755 "{}" +
# Setting special permissions for the build system scripts
chmod 755 "$BASE_DIR/scripts/feeds"
echo "Permissions have been fixed."