diff --git a/build.sh b/build.sh index 5a81798..84c4938 100755 --- a/build.sh +++ b/build.sh @@ -38,7 +38,7 @@ case "$1" in echo " "; echo " - Building all packages..."; echo " "; - for list in $(ls -1 "$workdir/conf" | grep -o "defconf-.*.txt" | sed -e "s|^defconf-||g" -e "s|.txt$||g"); do + for list in $(find "$workdir/conf" -name "defconf-*.txt" | sed -e "s|^$workdir/conf/defconf-||g" -e "s|.txt$||g"); do echo " - Executing build for $list..."; "$workdir/build.sh" "$list"; done; @@ -57,7 +57,7 @@ mkdir -p "$tmpdir"; # Config cp -f "$workdir/conf/defconf-$confvar.txt" "$tmpdir/defconf"; -chmod 0777 "$tmpdir/defconf"; +chmod +x "$tmpdir/defconf"; . "$tmpdir/defconf" || { echo " " >&2; echo "FATAL: Config for $confvar cannot be executed" >&2; return 1; }; echo " "; diff --git a/src/META-INF/com/google/android/update-binary b/src/META-INF/com/google/android/update-binary index cfd9906..6c18b0a 100644 --- a/src/META-INF/com/google/android/update-binary +++ b/src/META-INF/com/google/android/update-binary @@ -342,7 +342,7 @@ rm -rf "$filedir"; mkdir -p "$filedir"; unzip -o "$zipfile" "defconf" -d "$filedir/"; [ -f "$filedir/defconf" ] || abort "Could not find a default config"; -chmod 0777 "$filedir/defconf"; +chmod +x "$filedir/defconf"; . "$filedir/defconf" || abort "Could not execute default config"; moddir="/data/media/0/$modname"; @@ -494,7 +494,7 @@ if [ "$action" = "installation" ]; then if [ "$(grep "^$(echo "$line" | cut -d= -f1)" "/$sysroot/system/build.prop")" ]; then sed -i "s|^$(echo "$line" | cut -d= -f1)|#$modname $(echo "$line" | cut -d= -f1)|g" "/$sysroot/system/build.prop"; fi; - echo -e "$line #$modname" >> "/$sysroot/system/build.prop"; + echo "$line #$modname" >> "/$sysroot/system/build.prop"; done; } fi; @@ -503,7 +503,8 @@ if [ "$action" = "installation" ]; then ui_print "Setting permissions..."; if [ "$magisk" = "yes" ]; then find "$root" -maxdepth 1 -exec chmod 0755 {} +; - find "$root" -maxdepth 1 -name "post-fs-data.sh" -o -name "service.sh" -exec chmod 0777 {} +; + [ -f "$root/post-fs-data.sh" ] && chmod 0777 "$root/post-fs-data.sh"; + [ -f "$root/service.sh" ] && chmod 0777 "$root/service.sh"; fi; for thing in $stuff_perm $initdfile $addondfile; do case "$thing" in diff --git a/update.sh b/update.sh index 65a393c..3bec326 100755 --- a/update.sh +++ b/update.sh @@ -55,7 +55,7 @@ mkdir -p "$tmpdir" "$tmpdir/repos" "$(dirname "$updatelog")"; [ -f "$confdir/resdl-download.txt" ] || { echo " "; echo "F: No resdl-download.txt found"; return 1; } cp -f "$confdir/resdl-download.txt" "$tmpdir/resdlconf"; -chmod 0777 "$tmpdir/resdlconf"; +chmod +x "$tmpdir/resdlconf"; . "$tmpdir/resdlconf" || { echo " "; echo "FATAL: resdl-download.txt cannot be executed" >&2; return 1; }; if [ "$*" ]; then