diff --git a/BromiteWebView/service.sh b/BromiteWebView/service.sh deleted file mode 100644 index 04f0e7b7..00000000 --- a/BromiteWebView/service.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/system/bin/sh -# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... -# This will make your scripts compatible even if Magisk change its mount point in the future -MODDIR=${0%/*} - -# wait until boot completed -until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done - -# Bromite WebView needs to be installed as user app -pm list packages -f | grep -q /data.*com.android.webview || \ - pm install -r "${MODDIR}/system/app/BromiteWebView/BromiteWebView.apk" & diff --git a/BromiteWebView/service.sh b/BromiteWebView/service.sh new file mode 120000 index 00000000..d79dbee2 --- /dev/null +++ b/BromiteWebView/service.sh @@ -0,0 +1 @@ +../data/service.sh \ No newline at end of file diff --git a/FDroid/service.sh b/FDroid/service.sh deleted file mode 100644 index e46b8e53..00000000 --- a/FDroid/service.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/system/bin/sh -# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... -# This will make your scripts compatible even if Magisk change its mount point in the future -MODDIR=${0%/*} diff --git a/FDroid/service.sh b/FDroid/service.sh new file mode 120000 index 00000000..d79dbee2 --- /dev/null +++ b/FDroid/service.sh @@ -0,0 +1 @@ +../data/service.sh \ No newline at end of file diff --git a/Full/service.sh b/Full/service.sh deleted file mode 100644 index f5682252..00000000 --- a/Full/service.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/system/bin/sh -# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... -# This will make your scripts compatible even if Magisk change its mount point in the future -MODDIR=${0%/*} - -# Create private Log directory -LOGDIR="${MODDIR}/logs" - -[[ ! -d ${LOGDIR} ]] && mkdir -p "${LOGDIR}" - -# wait until boot completed -until [ `getprop vold.post_fs_data_done`. = 1. ]; do sleep 1; done - -# Set current date in 20170607-12.07.25 format -CURDATE=$(date +%Y%m%d-%H.%M.%S) - -# This script will be executed in late_start service mode -# More info in the main Magisk thread -for init in 10_sqlite 20_fstrim 30_logcat 40_external_sd 50_logscleaner; do - "${MODDIR}/init.d/${init}" | \ - tee -a "${LOGDIR}/${init}.log.${CURDATE}" & -done - -# wait until boot completed -until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done - -# in Magisk Mode microG DroidGuard Helper needs to be installed as user app -pm list packages -f | grep -q /data.*org.microg.gms.droidguard || \ - pm install -r "${MODDIR}/system/app/DroidGuard/DroidGuard.apk" & diff --git a/Full/service.sh b/Full/service.sh new file mode 120000 index 00000000..d79dbee2 --- /dev/null +++ b/Full/service.sh @@ -0,0 +1 @@ +../data/service.sh \ No newline at end of file diff --git a/OsmAnd/service.sh b/OsmAnd/service.sh deleted file mode 100644 index e46b8e53..00000000 --- a/OsmAnd/service.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/system/bin/sh -# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... -# This will make your scripts compatible even if Magisk change its mount point in the future -MODDIR=${0%/*} diff --git a/OsmAnd/service.sh b/OsmAnd/service.sh new file mode 120000 index 00000000..d79dbee2 --- /dev/null +++ b/OsmAnd/service.sh @@ -0,0 +1 @@ +../data/service.sh \ No newline at end of file diff --git a/data/service.sh b/data/service.sh new file mode 100644 index 00000000..a6945eea --- /dev/null +++ b/data/service.sh @@ -0,0 +1,65 @@ +#!/system/bin/sh + +MODDIR=${0%/*} +MODULE=$(basename ${MODDIR}) + +run_initscripts () { + # wait until boot completed + until [ `getprop vold.post_fs_data_done`. = 1. ]; do sleep 1; done + + # Set current date in 20170607-12.07.25 format + CURDATE=$(date +%Y%m%d-%H.%M.%S) + + # Create private Log directory + LOGDIR="${MODDIR}/logs" + + [[ ! -d ${LOGDIR} ]] && mkdir -p "${LOGDIR}" + + # NanoDroid init scripts + for init in 10_sqlite 20_fstrim 30_logcat 40_external_sd 50_logscleaner; do + "${MODDIR}/init.d/${init}" | tee -a "${LOGDIR}/${init}.log.${CURDATE}" & + done +} + +install_droidguardhelper () { + # wait until boot completed + until [ $(getprop sys.boot_completed). = 1. ]; do sleep 1; done + + # microG DroidGuard Helper needs to be installed as user app to prevent crashes + if [ -f "${MODDIR}/system/app/DroidGuard/DroidGuard.apk" ]; then + pm list packages -f | grep -q /data.*org.microg.gms.droidguard || \ + pm install -r "${MODDIR}/system/app/DroidGuard/DroidGuard.apk" & + fi +} + +install_bromitewebview () { + # wait until boot completed + until [ $(getprop sys.boot_completed). = 1. ]; do sleep 1; done + + # Bromite WebView needs to be installed as user app to prevent crashes + pm list packages -f | grep -q /data.*com.android.webview || \ + pm install -r "${MODDIR}/system/app/BromiteWebView/BromiteWebView.apk" & +} + +case ${MODULE} in + NanoDroid ) + run_initscripts & + install_droidguardhelper & + ;; + + NanoDroid_microG ) + install_droidguardhelper & + ;; + + NanoDroid_FDroid ) + exit 0 + ;; + + NanoDroid_BromiteWebView ) + install_bromitewebview & + ;; + + NanoDroid_OsmAnd ) + exit 0 + ;; +esac diff --git a/microG/service.sh b/microG/service.sh deleted file mode 100644 index 512c931b..00000000 --- a/microG/service.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/system/bin/sh -# Please don't hardcode /magisk/modname/... ; instead, please use $MODDIR/... -# This will make your scripts compatible even if Magisk change its mount point in the future -MODDIR=${0%/*} - -# wait until boot completed -until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done - -# in Magisk Mode microG DroidGuard Helper needs to be installed as user app -pm list packages -f | grep -q /data.*org.microg.gms.droidguard || \ - pm install -r "${MODDIR}/system/app/DroidGuard/DroidGuard.apk" & diff --git a/microG/service.sh b/microG/service.sh new file mode 120000 index 00000000..d79dbee2 --- /dev/null +++ b/microG/service.sh @@ -0,0 +1 @@ +../data/service.sh \ No newline at end of file