Use raw literals for scripts
This commit is contained in:
parent
23c1a1dab8
commit
5e44b0b9d5
@ -74,22 +74,24 @@ void exec_module_script(const char *stage, const vector<string> &module_list) {
|
||||
}
|
||||
}
|
||||
|
||||
static const char migrate_script[] =
|
||||
"IMG=%s;"
|
||||
"MNT=/dev/img_mnt;"
|
||||
"e2fsck -yf $IMG;"
|
||||
"mkdir -p $MNT;"
|
||||
"for num in 0 1 2 3 4 5 6 7; do"
|
||||
" losetup /dev/block/loop${num} $IMG || continue;"
|
||||
" mount -t ext4 /dev/block/loop${num} $MNT;"
|
||||
" rm -rf $MNT/lost+found $MNT/.core;"
|
||||
" magisk --clone $MNT " MODULEROOT ";"
|
||||
" umount $MNT;"
|
||||
" rm -rf $MNT;"
|
||||
" losetup -d /dev/block/loop${num};"
|
||||
" break;"
|
||||
"done;"
|
||||
"rm -rf $IMG;";
|
||||
constexpr char migrate_script[] =
|
||||
"MODULEROOT=" MODULEROOT R"EOF(
|
||||
IMG=%s
|
||||
MNT=/dev/img_mnt
|
||||
e2fsck -yf $IMG
|
||||
mkdir -p $MNT
|
||||
for num in 0 1 2 3 4 5 6 7; do
|
||||
losetup /dev/block/loop${num} $IMG || continue
|
||||
mount -t ext4 /dev/block/loop${num} $MNT
|
||||
rm -rf $MNT/lost+found $MNT/.core
|
||||
magisk --clone $MNT $MODULEROOT
|
||||
umount $MNT
|
||||
rm -rf $MNT
|
||||
losetup -d /dev/block/loop${num}
|
||||
break
|
||||
done
|
||||
rm -rf $IMG
|
||||
)EOF";
|
||||
|
||||
void migrate_img(const char *img) {
|
||||
LOGI("* Migrating %s\n", img);
|
||||
@ -99,11 +101,12 @@ void migrate_img(const char *img) {
|
||||
exec_command_sync(exec, "/system/bin/sh", "-c", cmds);
|
||||
}
|
||||
|
||||
static const char install_script[] =
|
||||
"APK=%s;"
|
||||
"log -t Magisk \"apk_install: $APK\";"
|
||||
"log -t Magisk \"apk_install: `pm install -r $APK 2>&1`\";"
|
||||
"rm -f $APK;";
|
||||
constexpr char install_script[] = R"EOF(
|
||||
APK=%s
|
||||
log -t Magisk "apk_install: $APK"
|
||||
log -t Magisk "apk_install: `pm install -r $APK 2>&1`"
|
||||
rm -f $APK
|
||||
)EOF";
|
||||
|
||||
void install_apk(const char *apk) {
|
||||
setfilecon(apk, "u:object_r:" SEPOL_FILE_DOMAIN ":s0");
|
||||
|
Loading…
Reference in New Issue
Block a user