Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 12 additions & 46 deletions bootanim.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/system/bin/sh
DEBUG="false"

# ======== variables ========
persist_dir=/data/adb/bootanimation
MODDIR=/data/adb/modules/bootanimation-module-ronux
Expand Down Expand Up @@ -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()
Expand All @@ -44,17 +43,19 @@ log_msg()
# ======== main func ========
set_ani(){
[ ! -f "$user_anipath" ] && abort_msg 'Bootanimation file not found!'
mkdir -p "$persist_dir"
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'
mkdir -p "$persist_dir" || abort_msg 'Could not create persist directory'
"$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'
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(){
Expand All @@ -77,40 +78,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!'

Expand All @@ -121,7 +88,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
15 changes: 3 additions & 12 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
29 changes: 16 additions & 13 deletions post-fs-data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
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
# reassign variables
system_path="$(cat "$persist_dir/bootanimation_path.txt")"
bootani_con="$(ls -Z "$system_path" 2>/dev/null | awk '{print $1}')"
fi


chcon "$bootani_con" "$bootani_file" 2>/dev/null
umount -l "$system_path"
mount --bind "$bootani_file" "$system_path"
5 changes: 4 additions & 1 deletion service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading