diff --git a/07_fix_permissions.sh b/07_fix_permissions.sh new file mode 100644 index 0000000..ee3bb23 --- /dev/null +++ b/07_fix_permissions.sh @@ -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." \ No newline at end of file