├── .gitignore
├── META-INF
└── com
│ └── google
│ └── android
│ ├── update-binary
│ └── updater-script
├── README.md
├── customize.sh
├── mSurvival.json
└── module.prop
/.gitignore:
--------------------------------------------------------------------------------
1 | # ignore out directory
2 | out/*
3 |
4 | # ignore mk, xfiles and DS_Store
5 | mk_*
6 | xfiles/*
7 | .DS_Store*
8 |
9 | # ignore backup and zip files.
10 | *.backup
11 | *.zip
12 |
--------------------------------------------------------------------------------
/META-INF/com/google/android/update-binary:
--------------------------------------------------------------------------------
1 | #!/sbin/sh
2 |
3 | #################
4 | # Initialization
5 | #################
6 |
7 | umask 022
8 |
9 | # echo before loading util_functions
10 | ui_print() { echo "$1"; }
11 |
12 | require_new_magisk() {
13 | ui_print "*******************************"
14 | ui_print " Please install Magisk v20.4+! "
15 | ui_print "*******************************"
16 | exit 1
17 | }
18 |
19 | #########################
20 | # Load util_functions.sh
21 | #########################
22 |
23 | OUTFD=$2
24 | ZIPFILE=$3
25 |
26 | mount /data 2>/dev/null
27 |
28 | [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
29 | . /data/adb/magisk/util_functions.sh
30 | [ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
31 |
32 | install_module
33 | exit 0
34 |
--------------------------------------------------------------------------------
/META-INF/com/google/android/updater-script:
--------------------------------------------------------------------------------
1 | #MAGISK
2 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Magisk OTA Survival
2 |
3 | Magisk Module
4 | Simple module that copies Magisk's addon.d script into system.
5 |
6 | ## Description
7 | This module is for custom roms (LineageOS for example) that support addon.d survival scripts.
8 | Survival scripts are used to backup and restore additional files/installs during a system (rom) update.
9 | Most notably would be a GApps install.
10 |
11 | When Magisk is installed via recovery, it will copy it's addon.d script into the `system/addon.d` directory.
12 | This allows Magisk to survive a system (rom) OTA update.
13 |
14 | ---
15 |
16 | For Magisk installs not (or can not be) installed via recovery.
17 | The addon.d script can not be copied into `system/addon.d` since system is mounted read-only.
18 |
19 | This module will overlay a copy of the addon.d script into `system/addon.d`.
20 | So it can be found and run with other addon.d script(s) during a system OTA update.
21 |
22 | Note: This module only works with addon.d-v2 (A/B slot devices).
23 |
24 | ## Warning
25 | This module is only systemless before the first OTA update.
26 | Magisk's addon.d script will be restored directly into `system/addon.d` by the OTA updater.
27 | After the first OTA update, this module is no longer needed and can be disabled and/or removed.
28 |
29 | ### Download
30 | Available in the releases tab. [Link](https://github.com/mModule/mSurvival/releases)
31 |
32 | ### Install
33 | - Copy the zip file to the device.
34 | - Open Magisk, select Modules and then Install from storage.
35 | - Reboot device
36 |
37 | ### Recent changes
38 | - Initial release.
39 | - Not planned for long-term support.
40 |
41 | ### Notes
42 | - Feel free to use, change, improve, adapt.
43 | - Remember to share.
44 |
45 | ### Credits
46 | - The Android Community and everyone who has helped me learn through the years.
47 | - John Wu and team for all things Magisk.
48 |
--------------------------------------------------------------------------------
/customize.sh:
--------------------------------------------------------------------------------
1 | #!/system/bin/sh
2 |
3 | ## Magisk OTA Survival module.
4 | ## This module will overlay Magisk's addon.d script into the system/addon.d directory if it exists.
5 | ## ipdev @ xda-developers
6 |
7 | # __ Define variables. __
8 |
9 | ### Magisk variables
10 | ## MODPATH (path): the path where your module files should be installed.
11 |
12 | # ADB Directory
13 | ADB=/data/adb
14 |
15 | # __ Define functions. __
16 |
17 | ### Magisk functions
18 | ## set_perm [context]
19 |
20 | # __ Here we go. __
21 |
22 | if [ -d /system/addon.d ]; then
23 | # Make the module addon.d directory if it does not exist.
24 | if [ ! -d "$MODPATH"/system/addon.d ]; then
25 | mkdir -p "$MODPATH"/system/addon.d
26 | else
27 | # Remove the previous addon.d script.
28 | rm "$MODPATH"/system/addon.d/99-magisk.sh
29 | fi
30 |
31 | # Copy the current addon.d script from magisk to the module directory.
32 | cp "$ADB"/magisk/addon.d.sh "$MODPATH"/system/addon.d/99-magisk.sh
33 |
34 | # Set owner, group, permission and security.
35 | set_perm "$MODPATH"/system/addon.d/99-magisk.sh 0 0 0755 u:object_r:system_file:s0
36 | else
37 | echo "Survival (addon.d) scripts are not supported."
38 | echo " This module will not be installed."
39 | rm -rf "$ADB"/modules_update/MagiskSurvival
40 | exit 1
41 | fi
42 |
43 | # __ Finish and Cleanup. __
44 |
45 |
--------------------------------------------------------------------------------
/mSurvival.json:
--------------------------------------------------------------------------------
1 | {
2 | "versionCode": "10",
3 | "version": "Module (v1)",
4 | "zipUrl": "https://github.com/mModule/mSurvival/releases/download/v1/MagiskSurvival-v1.zip",
5 | "changelog": "https://github.com/mModule/mSurvival/releases/download/v1/v1.md"
6 | }
7 |
--------------------------------------------------------------------------------
/module.prop:
--------------------------------------------------------------------------------
1 | id=MagiskSurvival
2 | name=Magisk Survival Script
3 | version=Module (v1)
4 | versionCode=10
5 | author=ip
6 | description=Magisk Survival (addon.d) script.
7 | updateJson=https://raw.githubusercontent.com/mModule/mSurvival/master/mSurvival.json
8 |
--------------------------------------------------------------------------------