From 922633b7f9feaf65fca1a9cffbe6c81b6f26e687 Mon Sep 17 00:00:00 2001 From: readonlynux Date: Sun, 11 Oct 2026 15:52:16 +0300 Subject: [PATCH 1/6] refactor(service.sh): add check the magisktmp variable --- service.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/service.sh b/service.sh index be1bd42..14642b0 100644 --- a/service.sh +++ b/service.sh @@ -10,5 +10,8 @@ elif [ "$APATCH" = "true" ]; then else [ -w /sbin ] && magisktmp=/sbin [ -w /debug_ramdisk ] && magisktmp=/debug_ramdisk - ln -sf "$MOD_PATH/bootanim.sh" "$magisktmp/bootanim" + # check magisktmp + [ -z "$magisktmp" ] && log -t bootanimation-module-ronux 'MagiskTMP dir not found or inaccessible, bootanim not linked' && exit 1 + # link the bootanim to magisktmp + ln -sf "$MOD_PATH/bootanim.sh" "$magisktmp/bootanim" fi From 4677174cf8255a7f660da6a3e41cb3bc4e1d306e Mon Sep 17 00:00:00 2001 From: readonlynux Date: Sun, 11 Oct 2026 16:21:49 +0300 Subject: [PATCH 2/6] refactor(bootanim.sh): cleanup unnecessary function, add a fail-safe to the function, and fix minor typos --- bootanim.sh | 54 +++++++++++------------------------------------------ 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/bootanim.sh b/bootanim.sh index 395da39..5083f97 100644 --- a/bootanim.sh +++ b/bootanim.sh @@ -1,6 +1,4 @@ #!/system/bin/sh -DEBUG="false" - # ======== variables ======== persist_dir=/data/adb/bootanimation MODDIR=/data/adb/modules/bootanimation-module-ronux @@ -29,6 +27,7 @@ abort_msg(){ else echo "ERROR\n\n$abortInp" fi + log -t bootanimation-module-ronux-bootanim "E: $abortInp" exit 1 } log_msg() @@ -44,17 +43,21 @@ log_msg() # ======== main func ======== set_ani(){ [ ! -f "$user_anipath" ] && abort_msg 'Bootanimation file not found!' - mkdir -p "$persist_dir" + mkdir -p "$persist_dir" || abort_msg 'Could not create persist directory' if [ ! -f "$persist_dir/bootanimation_path.txt" ]; then $MODDIR/create_bootanimation_pathfile.sh [ "$?" = "100" ] && abort_msg 'Bootanimation file was not found in the system path' fi + # fail-safe + tmp_path="$bootani_path.tmp" + if ! cp -f "$user_anipath" "$tmp_path" || ! chmod 644 "$tmp_path" || ! chown "root:root" "$tmp_path"; then + rm -f "$tmp_path" + abort_msg 'Copy failed, and custom bootanimation not changed' + fi + mv -f "$tmp_path" "$bootani_path" || { rm -f "$tmp_path"; abort_msg 'Could not replace bootanimation'; } + chcon "u:object_r:system_file:s0" "$bootani_path" 2>/dev/null rm -f "$persist_dir/disable" - cp -f "$user_anipath" "$bootani_path" - chcon "u:object_r:system_file:s0" "$bootani_path" - chown root:root "$bootani_path" - chmod 644 "$bootani_path" - log_msg 'Bootanimation applied succesfully' + log_msg 'Bootanimation applied successfully' exit } reset_ani(){ @@ -77,40 +80,6 @@ state_ani(){ [ -f "$persist_dir/disable" ] && log_msg 'State: disabled' [ ! -f "$persist_dir/disable" ] && log_msg 'State: enabled' } -debug_mode(){ - [ "$DEBUG" = "false" ] && abort_msg "This feature is disabled in the release versions" - if [ "$isModule" = "yes" ]; then - # Disable Debug mode - if [ -f "$MODDIR/debug_mod" ]; then - read -p 'All settings will be reverted for testing purposes. Do you want to continue (y/N): ' userInp - if [ "$userInp" = 'y' ]; then - rm -rf "$MODDIR/debug_mod" 2>/dev/null - mv "$MODDIR/webroot_disabled" "$MODDIR/webroot" 2>/dev/null - mv "$MODDIR/post-fs-data.sh_disabled" "$MODDIR/post-fs-data.sh" - exit - else - abort_msg 'Aborted' - fi - fi - # Enable Debug mode - touch "$MODDIR/debug_mod" - read -p "Do you want WebUI disabled for testing purposes (y/N): " userInp - if [ "$userInp" = 'y' ]; then - [ -f "$MODDIR/webroot" ] && mv "$MODDIR/webroot" "$MODDIR/webroot_disabled" && log_msg 'WebUI disabled' - fi - read -p "Do you want the post-fs-data script to run every boot (y/N): " userInp - [ "$userInp" = 'y' ] && mv "$MODDIR/post-fs-data.sh" "$MODDIR/post-fs-data.sh_disabled" && log_msg 'post-fs-data.sh disabled' - fi -} - -if [ "$DEBUG" = "true" ]; then - # Detect the environment (for debugging) - if [ -f "$MODDIR/bootanim.sh" ]; then - isModule="yes" - else - isModule="no" - fi -fi [ "$(id -u)" != "0" ] && abort_msg 'Superuser privileges are required!' @@ -121,7 +90,6 @@ case "$user_command" in -r|--reset) reset_ani ;; -st|--state) state_ani ;; -h|--help) help_menu ;; - -dbg|--debug) debug_mode ;; '') help_menu && exit 1 ;; *) help_menu && exit 1 ;; esac From 6728feb6d15d3116501b43ac514b2db3419060bf Mon Sep 17 00:00:00 2001 From: readonlynux Date: Sun, 11 Oct 2026 16:33:35 +0300 Subject: [PATCH 3/6] refactor(post-fs-data.sh): remove unnecessary extra checks and fix code prioritization --- post-fs-data.sh | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/post-fs-data.sh b/post-fs-data.sh index 604173b..ee42062 100644 --- a/post-fs-data.sh +++ b/post-fs-data.sh @@ -2,19 +2,20 @@ MODDIR=${0%/*} persist_dir=/data/adb/bootanimation bootani_file=$persist_dir/bootanimation.zip -system_path="$(cat "$persist_dir/bootanimation_path.txt")" -bootani_con="$(ls -Z "$system_path" 2>/dev/null | awk '{print $1}')" [ -f "$persist_dir/disable" ] && exit -if [ ! -f "$bootani_file" ]; then - exit 1 -elif [ -f "$bootani_file" ]; then - if [ ! -f "$system_path" ]; then - [ -f "$persist_dir/bootanimation_path.txt" ] && rm "$persist_dir/bootanimation_path.txt" - $MODDIR/create_bootanimation_pathfile.sh - exit - fi - chcon "$bootani_con" "$bootani_file" 2>/dev/null - umount -l "$system_path" - mount --bind "$bootani_file" "$system_path" + + +[ ! -f "$bootani_file" ] && exit 1 +system_path="$(cat "$persist_dir/bootanimation_path.txt")" +bootani_con="$(ls -Z "$system_path" 2>/dev/null | awk '{print $1}')" +if [ ! -f "$system_path" ]; then + [ -f "$persist_dir/bootanimation_path.txt" ] && rm "$persist_dir/bootanimation_path.txt" + $MODDIR/create_bootanimation_pathfile.sh + exit fi + + +chcon "$bootani_con" "$bootani_file" 2>/dev/null +umount -l "$system_path" +mount --bind "$bootani_file" "$system_path" From eecf38d69167fde38cca5d06f21c84474dbe0ea7 Mon Sep 17 00:00:00 2001 From: readonlynux Date: Sun, 11 Oct 2026 17:04:15 +0300 Subject: [PATCH 4/6] refactor(customize.sh): remove unnecessary code --- customize.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/customize.sh b/customize.sh index fb04e0d..ba53010 100644 --- a/customize.sh +++ b/customize.sh @@ -3,15 +3,6 @@ persist_dir="/data/adb/bootanimation" ui_print '- Installing Bootanimation Module without OverlayFS' chmod +x $MODPATH/*.sh -for i in "/product/media/bootanimation.zip" "/system/product/media/bootanimation.zip" "/system/media/bootanimation.zip" "/oem/media/bootanimation.zip"; do - if [ -f "$i" ]; then - TARGET_PATH="$i" - break - fi -done -if [ -n "$TARGET_PATH" ]; then - mkdir -p "$persist_dir" - echo "$TARGET_PATH" >"$persist_dir/bootanimation_path.txt" -else - abort '! Bootanimation file was not found in the system path' -fi +"$MODPATH/create_bootanimation_pathfile.sh" +[ "$?" = "100" ] && abort '! Bootanimation file was not found in the system path' +ui_print '- Installed! Please reboot to use!' From 78e549d9ac5aa6623b650c4fbb72f03c59fa6145 Mon Sep 17 00:00:00 2001 From: readonlynux Date: Sun, 11 Oct 2026 22:07:28 +0300 Subject: [PATCH 5/6] fix(shellscript): general improvements, and re-detect bootanimation path on every apply in bootanim.sh --- bootanim.sh | 8 +++----- post-fs-data.sh | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/bootanim.sh b/bootanim.sh index 5083f97..b5b6079 100644 --- a/bootanim.sh +++ b/bootanim.sh @@ -44,15 +44,13 @@ log_msg() set_ani(){ [ ! -f "$user_anipath" ] && abort_msg 'Bootanimation file not found!' mkdir -p "$persist_dir" || abort_msg 'Could not create persist directory' - if [ ! -f "$persist_dir/bootanimation_path.txt" ]; then - $MODDIR/create_bootanimation_pathfile.sh - [ "$?" = "100" ] && abort_msg 'Bootanimation file was not found in the system path' - fi + "$MODDIR/create_bootanimation_pathfile.sh" + [ "$?" = "100" ] && abort_msg 'Bootanimation file was not found in the system path' # fail-safe tmp_path="$bootani_path.tmp" if ! cp -f "$user_anipath" "$tmp_path" || ! chmod 644 "$tmp_path" || ! chown "root:root" "$tmp_path"; then rm -f "$tmp_path" - abort_msg 'Copy failed, and custom bootanimation not changed' + abort_msg 'Copy failed, and custom bootanimation not changed' fi mv -f "$tmp_path" "$bootani_path" || { rm -f "$tmp_path"; abort_msg 'Could not replace bootanimation'; } chcon "u:object_r:system_file:s0" "$bootani_path" 2>/dev/null diff --git a/post-fs-data.sh b/post-fs-data.sh index ee42062..46fb982 100644 --- a/post-fs-data.sh +++ b/post-fs-data.sh @@ -11,7 +11,7 @@ system_path="$(cat "$persist_dir/bootanimation_path.txt")" bootani_con="$(ls -Z "$system_path" 2>/dev/null | awk '{print $1}')" if [ ! -f "$system_path" ]; then [ -f "$persist_dir/bootanimation_path.txt" ] && rm "$persist_dir/bootanimation_path.txt" - $MODDIR/create_bootanimation_pathfile.sh + "$MODDIR/create_bootanimation_pathfile.sh" exit fi From 45c8f48a0ae2896b660040e6d6f38dd5a825909c Mon Sep 17 00:00:00 2001 From: readonlynux Date: Wed, 14 Oct 2026 19:06:59 +0300 Subject: [PATCH 6/6] refactor(post-fs-data): rebuilding the cache and resuming during boot --- post-fs-data.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/post-fs-data.sh b/post-fs-data.sh index 46fb982..c3257d9 100644 --- a/post-fs-data.sh +++ b/post-fs-data.sh @@ -11,8 +11,10 @@ system_path="$(cat "$persist_dir/bootanimation_path.txt")" bootani_con="$(ls -Z "$system_path" 2>/dev/null | awk '{print $1}')" if [ ! -f "$system_path" ]; then [ -f "$persist_dir/bootanimation_path.txt" ] && rm "$persist_dir/bootanimation_path.txt" - "$MODDIR/create_bootanimation_pathfile.sh" - exit + "$MODDIR/create_bootanimation_pathfile.sh" || exit + # reassign variables + system_path="$(cat "$persist_dir/bootanimation_path.txt")" + bootani_con="$(ls -Z "$system_path" 2>/dev/null | awk '{print $1}')" fi