Skip to content

Commit

Permalink
implement in-place update [WIP]
Browse files Browse the repository at this point in the history
WIP: /system/etc/hosts might be filesystem-writable but the enclosing filesystem itself might not be mounted writable
  • Loading branch information
programminghoch10 committed Dec 24, 2024
1 parent d840fa9 commit 3ecd8f2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ disable=SC2004

# redundant sed invocation
disable=SC2001

# referencing unassigned variable
# we need to reference magisk pre-set variables a lot
disable=SC2154
20 changes: 20 additions & 0 deletions magiskmodule/customize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/system/bin/sh

exec 2>&1

[ "$BOOTMODE" != "true" ] && abort "Please install this module within the Magisk app."

# path to already installed module
INSTALLEDMODPATH=/data/adb/modules/MagicalProtection

[ ! -d "$INSTALLEDMODPATH" ] && return 0
[ ! -w /system/etc/hosts ] && return 0

ui_print "- Performing in-place update"

cp -v -r -f "$MODPATH"/* "$INSTALLEDMODPATH"
cp -v -f "$MODPATH"/system/etc/hosts /system/etc/hosts

rm -v -r "$MODPATH"

exit 0

0 comments on commit 3ecd8f2

Please sign in to comment.