2018-01-23 20:11:52 +00:00
|
|
|
#!/sbin/sh
|
|
|
|
|
2020-08-18 15:26:18 +00:00
|
|
|
VERSION=22.6.91.99999999
|
2018-07-30 19:14:22 +00:00
|
|
|
NANODROID_UPGRADE=0
|
2018-11-18 21:37:40 +00:00
|
|
|
INSTALL_SUCCESS=TRUE
|
2018-08-21 19:59:15 +00:00
|
|
|
NANODROID_LIST=/data/adb/NanoDroid_FileList
|
2020-08-20 21:34:33 +00:00
|
|
|
|
2019-05-05 10:17:26 +00:00
|
|
|
STORAGE=/data/media/0
|
2020-08-20 21:34:33 +00:00
|
|
|
curdate=$(date +%Y%m%d_%H.%M.%S)
|
|
|
|
nanodroid_logfile="${STORAGE}/nanodroid_logs/${MODID}_${VERSION}_log_${curdate}.log"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-02-04 19:00:54 +00:00
|
|
|
print_google_apps()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
AMAPNetworkLocation
|
2018-08-24 22:28:06 +00:00
|
|
|
BaiduNetworkLocation
|
|
|
|
BlankStore
|
2018-12-20 20:30:24 +00:00
|
|
|
ConfigUpdater
|
2018-12-03 19:30:48 +00:00
|
|
|
GCS
|
2018-08-24 22:28:06 +00:00
|
|
|
GmsCoreSetupPrebuilt
|
|
|
|
GmsCore_update
|
|
|
|
GoogleFeedback
|
2018-03-13 19:30:55 +00:00
|
|
|
GoogleLoginService
|
|
|
|
GoogleOneTimeInitializer
|
2018-08-24 19:25:01 +00:00
|
|
|
GoogleServicesFramework
|
2018-12-03 19:30:48 +00:00
|
|
|
GoogleConnectivityServices
|
2018-08-24 19:25:01 +00:00
|
|
|
GoogleTTS
|
2018-08-24 22:28:06 +00:00
|
|
|
LegacyNetworkLocation
|
|
|
|
MarketUpdater
|
|
|
|
MarkupGoogle
|
|
|
|
NetworkLocation
|
2019-07-13 17:53:00 +00:00
|
|
|
Phonesky
|
2018-08-24 22:28:06 +00:00
|
|
|
PlayGames
|
|
|
|
PlayStore
|
|
|
|
PrebuiltGmsCore
|
2018-12-03 19:30:48 +00:00
|
|
|
PrebuiltGmsCorePi
|
2018-11-29 21:22:07 +00:00
|
|
|
PrebuiltGmsCorePix
|
2018-08-24 22:28:06 +00:00
|
|
|
UnifiedNlp
|
|
|
|
Velvet
|
|
|
|
Vending
|
2019-02-04 19:00:54 +00:00
|
|
|
WhisperPush
|
|
|
|
EOF
|
|
|
|
}
|
2018-07-08 15:21:02 +00:00
|
|
|
|
2019-02-04 19:00:54 +00:00
|
|
|
print_google_data ()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
com.amap.android.location
|
2018-08-24 22:28:06 +00:00
|
|
|
com.baidu.location
|
|
|
|
com.google.android.location
|
2018-03-13 19:30:55 +00:00
|
|
|
org.microg.nlp
|
2019-02-04 19:00:54 +00:00
|
|
|
org.microg.unifiednlp
|
|
|
|
EOF
|
|
|
|
}
|
2018-03-13 19:30:55 +00:00
|
|
|
|
2019-02-04 19:00:54 +00:00
|
|
|
print_google_data_dirty ()
|
|
|
|
{
|
|
|
|
cat <<EOF
|
|
|
|
com.android.vending
|
2019-01-01 19:58:44 +00:00
|
|
|
com.google.android.gms
|
2018-10-11 16:50:51 +00:00
|
|
|
com.google.android.gsf
|
2019-01-01 19:58:44 +00:00
|
|
|
com.google.android.gsf.login
|
|
|
|
com.google.android.feedback
|
2019-02-04 19:00:54 +00:00
|
|
|
com.mgoogle.android.gms
|
|
|
|
EOF
|
|
|
|
}
|
2018-10-11 16:50:51 +00:00
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Misc. Functions
|
|
|
|
##########################################################################################
|
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
decho () {
|
|
|
|
mkdir -p "${STORAGE}/nanodroid_logs"
|
|
|
|
|
|
|
|
if ${BOOTMODE}; then
|
|
|
|
echo "$@" >> "${nanodroid_logfile}"
|
|
|
|
else
|
|
|
|
echo "$@"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2019-04-27 21:24:13 +00:00
|
|
|
check_space () {
|
2019-05-12 20:19:52 +00:00
|
|
|
space_required=524288
|
|
|
|
space_available=$(df /dev 2>/dev/null | awk '/tmpfs/{print $4}')
|
2019-04-27 21:24:13 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " required space : ${space_required}"
|
|
|
|
decho " available space: ${space_available}"
|
2019-05-12 20:19:52 +00:00
|
|
|
|
|
|
|
if [ ${space_available} -lt ${space_required} ]; then
|
2019-04-27 21:24:13 +00:00
|
|
|
error "Less than 512 MB free space availabe from TWRP!"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
detect_bootmode () {
|
2020-08-18 16:13:09 +00:00
|
|
|
[ -z ${BOOTMODE} ] && ps | grep zygote | grep -qv grep && BOOTMODE=true
|
|
|
|
[ -z ${BOOTMODE} ] && ps -A 2>/dev/null | grep zygote | grep -qv grep && BOOTMODE=true
|
2018-11-09 20:11:57 +00:00
|
|
|
[ -z ${BOOTMODE} ] && BOOTMODE=false
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info () {
|
2018-01-23 20:11:52 +00:00
|
|
|
if ${BOOTMODE}; then
|
|
|
|
echo "${@}"
|
2020-08-20 21:34:33 +00:00
|
|
|
decho "${@}"
|
2018-01-23 20:11:52 +00:00
|
|
|
else
|
2018-03-28 18:18:25 +00:00
|
|
|
echo -n -e "ui_print ${@}\n" >> /proc/self/fd/${OUTFD}
|
|
|
|
echo -n -e "ui_print\n" >> /proc/self/fd/${OUTFD}
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-03-28 18:06:53 +00:00
|
|
|
show_progress() {
|
2020-08-20 20:11:24 +00:00
|
|
|
${BOOTMODE} || echo "progress ${1} ${2}" >> /proc/self/fd/${OUTFD}
|
2018-03-28 18:06:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
set_progress() {
|
2020-08-20 20:11:24 +00:00
|
|
|
${BOOTMODE} || echo "set_progress ${1}" >> /proc/self/fd/${OUTFD}
|
2018-03-28 18:06:53 +00:00
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
grep_prop() {
|
2019-10-25 18:47:43 +00:00
|
|
|
sed -n "s/^${1}=//p" ${build_props} | head -n 1
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2018-07-08 15:33:43 +00:00
|
|
|
grep_cmdline() {
|
|
|
|
local REGEX="s/^${1}=//p"
|
|
|
|
sed -E 's/ +/\n/g' /proc/cmdline | \
|
|
|
|
sed -n "${REGEX}" 2>/dev/null
|
|
|
|
}
|
|
|
|
|
2019-10-23 20:05:21 +00:00
|
|
|
is_mounted () {
|
2019-03-28 19:09:41 +00:00
|
|
|
grep -q "$(readlink -f ${1})" /proc/mounts 2>/dev/null
|
2018-01-23 20:11:52 +00:00
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2018-11-09 20:11:57 +00:00
|
|
|
set_perm () {
|
2018-09-07 16:21:48 +00:00
|
|
|
chown ${2}:${3} ${1} || error "failed change owner for ${1}"
|
|
|
|
chmod ${4} ${1} || error "failed to change mode for ${1}"
|
2018-11-09 20:11:57 +00:00
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
if [ ! -z "${5}" ]; then
|
|
|
|
chcon ${5} ${1} 2>/dev/null
|
|
|
|
else chcon 'u:object_r:system_file:s0' ${1} 2>/dev/null
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_perm_recursive() {
|
|
|
|
find ${1} -type d 2>/dev/null | while read dir; do
|
|
|
|
set_perm ${dir} ${2} ${3} ${4} ${6}
|
|
|
|
done
|
|
|
|
find ${1} -type f 2>/dev/null | while read file; do
|
|
|
|
set_perm ${file} ${2} ${3} ${5} ${6}
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
set_perm_data () {
|
|
|
|
if [ "${1}" = "-r" ]; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " perm: data [recursive] {${2}}"
|
2018-01-23 20:11:52 +00:00
|
|
|
set_perm_recursive ${2} 0 0 0755 0644
|
|
|
|
else
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " perm: data [single] {${1}}"
|
2018-01-23 20:11:52 +00:00
|
|
|
set_perm ${1} 0 0 0644
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
set_perm_bin () {
|
|
|
|
if [ "${1}" = "-r" ]; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " perm: exec [recursive] {${2}}"
|
2018-01-23 20:11:52 +00:00
|
|
|
set_perm_recursive ${2} 0 0 0755 0755
|
|
|
|
else
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " perm: exec [single] {${1}}"
|
2018-01-23 20:11:52 +00:00
|
|
|
set_perm ${1} 0 0 0755
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-08-23 19:27:15 +00:00
|
|
|
installinfo_add () {
|
2018-08-21 19:59:15 +00:00
|
|
|
if [ "${MODE}" = "SYSTEM" ]; then
|
|
|
|
for file in ${@}; do
|
|
|
|
echo ${file} >> ${NANODROID_LIST}
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
detect_outfd () {
|
2018-09-08 18:02:46 +00:00
|
|
|
if [ -z $OUTFD ] || readlink /proc/$$/fd/$OUTFD | grep -q /tmp; then
|
|
|
|
# We will have to manually find out OUTFD
|
|
|
|
for FD in `ls /proc/$$/fd`; do
|
|
|
|
if readlink /proc/$$/fd/$FD | grep -q pipe; then
|
|
|
|
if ps | grep -v grep | grep -q " 3 $FD "; then
|
|
|
|
OUTFD=$FD
|
2018-01-23 20:11:52 +00:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
show_banner () {
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " "
|
|
|
|
print_info "*****************************"
|
|
|
|
print_info " NanoDroid "
|
2018-01-23 20:11:52 +00:00
|
|
|
case ${MODID} in
|
2018-08-19 16:58:48 +00:00
|
|
|
NanoDroid )
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Full package "
|
2018-08-19 16:58:48 +00:00
|
|
|
;;
|
2018-01-23 20:11:52 +00:00
|
|
|
NanoDroid_microG )
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > microG package "
|
2018-01-23 20:11:52 +00:00
|
|
|
;;
|
|
|
|
NanoDroid_FDroid )
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > F-Droid package "
|
2018-01-23 20:11:52 +00:00
|
|
|
;;
|
2018-11-08 17:46:56 +00:00
|
|
|
NanoDroid_BromiteWebView )
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Bromite WebView package "
|
2018-11-08 17:46:56 +00:00
|
|
|
;;
|
2018-11-23 20:04:36 +00:00
|
|
|
NanoDroid_OsmAnd )
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > OsmAnd package "
|
2018-11-23 20:04:36 +00:00
|
|
|
;;
|
2020-01-17 21:36:13 +00:00
|
|
|
NanoDroid_Google )
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Google package "
|
2020-01-17 21:36:13 +00:00
|
|
|
;;
|
2018-01-23 20:11:52 +00:00
|
|
|
esac
|
2019-10-08 19:20:50 +00:00
|
|
|
|
|
|
|
if [ "${ZIP}" == *${VERSION}* ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ${VERSION} "
|
2019-10-08 19:20:50 +00:00
|
|
|
else
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ${VERSION} (snapshot) "
|
2019-10-08 19:20:50 +00:00
|
|
|
fi
|
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info "*****************************"
|
|
|
|
print_info " "
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
error () {
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " !!"
|
|
|
|
print_info "${@}"
|
|
|
|
print_info " !!"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-05-12 20:28:49 +00:00
|
|
|
if is_mounted /data; then
|
|
|
|
[ "${MODE}" = "MAGISK" ] && rm -rf "${MODPATH}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
recovery_cleanup_env
|
2018-11-18 21:37:40 +00:00
|
|
|
|
2019-05-12 20:28:49 +00:00
|
|
|
INSTALL_SUCCESS=FALSE
|
|
|
|
nanodroid_storelogs
|
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
# taken from Magisk, with modifications for NanoDroid
|
|
|
|
mount_apex_loop () {
|
|
|
|
local number=0
|
|
|
|
local minorx=1
|
|
|
|
local loop
|
|
|
|
|
|
|
|
[ -e /dev/block/loop1 ] && minorx=$(stat -Lc '%T' /dev/block/loop1)
|
|
|
|
|
|
|
|
apex_mount="${1}"
|
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " *** mount_apex_loop [apex_mount]: ${apex_mount}"
|
2020-08-15 17:55:00 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
while [ ${number} -lt 64 ]; do
|
|
|
|
loop=/dev/block/loop${number}
|
|
|
|
[ -e ${loop} ] || mknod ${loop} b 7 $((number * minorx))
|
|
|
|
|
2020-08-15 17:55:00 +00:00
|
|
|
if losetup "${loop}" /apex/apex_payload.img 2>/dev/null; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " *** mount_apex_loop [loop]: ${loop}"
|
2020-08-11 19:25:48 +00:00
|
|
|
if mount -text4 -oro,noatime "${loop}" "${apex_mount}"; then
|
|
|
|
rm -f /apex/apex_payload.img
|
|
|
|
break
|
|
|
|
fi
|
2019-10-10 17:06:12 +00:00
|
|
|
fi
|
2019-10-07 20:11:35 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
number=$((number + 1))
|
|
|
|
done
|
|
|
|
}
|
2019-10-07 20:11:35 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
# taken from Magisk, with modifications for NanoDroid
|
|
|
|
mount_apex () {
|
2020-08-20 21:34:33 +00:00
|
|
|
APEX_LD=/apex/com.android.runtime
|
2019-10-07 20:11:35 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
mkdir -p /apex
|
2020-04-17 18:45:32 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
for apex in /system/apex/*; do
|
|
|
|
apex_mount="/apex/$(basename ${apex} .apex)"
|
|
|
|
apex_loop="/dev/loop_apex_$(basename ${apex} .apex)"
|
2020-08-11 19:25:48 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
[ "${apex_mount}" == /apex/com.android.runtime.release ] && apex_mount=/apex/com.android.runtime
|
|
|
|
[ "${apex_mount}" == /apex/com.android.runtime.debug ] && apex_mount=/apex/com.android.runtime
|
2020-08-11 19:25:48 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
mkdir -p "${apex_mount}"
|
2020-08-11 19:25:48 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
if [ -f "${apex}" ]; then
|
|
|
|
unzip -oq "${apex}" apex_payload.img -d /apex
|
|
|
|
mount_apex_loop "${apex_mount}" || error "APEX loop setup failed!"
|
|
|
|
elif [ -d "${apex}" ]; then
|
|
|
|
mount -o bind "${apex}" "${apex_mount}"
|
|
|
|
fi
|
|
|
|
done
|
2020-08-11 19:25:48 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
export ANDROID_RUNTIME_ROOT=/apex/com.android.runtime
|
|
|
|
export ANDROID_TZDATA_ROOT=/apex/com.android.tzdata
|
2020-04-17 18:45:32 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
echo " INFO: #10 [APEX_LD] ${APEX_LD}"
|
2020-08-18 08:44:57 +00:00
|
|
|
echo " INFO: #11 [APEX [ALL]] $(ls /system/apex/*)"
|
2019-10-23 18:52:43 +00:00
|
|
|
}
|
|
|
|
|
2020-08-17 16:54:55 +00:00
|
|
|
# taken from Magisk, with minor modifications for NanoDroid
|
2019-10-23 18:52:43 +00:00
|
|
|
mount_partitions () {
|
2020-08-20 21:34:33 +00:00
|
|
|
if ${BOOTMODE}; then
|
|
|
|
APEX_LD=/apex/com.android.runtime
|
|
|
|
export build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
|
|
|
else
|
|
|
|
DEVICE_AB=FALSE
|
|
|
|
VENDOR_COMPAT=FALSE
|
|
|
|
SYSTEM_AS_ROOT=FALSE
|
|
|
|
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot_suffix)
|
|
|
|
echo " INFO: #1 [SLOT] ${SLOT}"
|
|
|
|
if [ -z ${SLOT} ]; then
|
|
|
|
SLOT=$(grep_cmdline androidboot.slot)
|
|
|
|
echo " INFO: #2 [SLOT] ${SLOT}"
|
|
|
|
if [ ! -z ${SLOT} ]; then
|
|
|
|
SLOT=_${SLOT}
|
|
|
|
echo " INFO: #3 [SLOT] ${SLOT}"
|
|
|
|
DEVICE_AB=TRUE
|
|
|
|
fi
|
2019-10-23 19:33:35 +00:00
|
|
|
fi
|
2019-10-23 18:52:43 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
system_tmp=$(find /dev/block -type l -name system${SLOT} | head -n 1)
|
|
|
|
echo " INFO: #4 [system_tmp] ${system_tmp}"
|
|
|
|
SYSTEM_BLOCK=$(readlink -f ${system_tmp})
|
|
|
|
echo " INFO: #5 [SYSTEM_BLOCK] ${SYSTEM_BLOCK}"
|
2019-10-23 18:52:43 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
is_mounted /data || mount /data || error "failed to mount /data!"
|
2019-10-23 18:52:43 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
mount -o bind /dev/urandom /dev/random
|
|
|
|
! is_mounted /system && mount -o rw /system
|
|
|
|
! is_mounted /system && mount -o rw ${SYSTEM_BLOCK} /system
|
|
|
|
! is_mounted /system && error "failed to mount /system!"
|
2019-10-23 19:33:35 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
if [ -f /system/init.rc ]; then
|
|
|
|
SYSTEM_AS_ROOT=true
|
|
|
|
[ -L /system_root ] && rm -f /system_root
|
|
|
|
mkdir /system_root 2>/dev/null
|
|
|
|
mount --move /system /system_root
|
|
|
|
mount -o bind /system_root/system /system
|
|
|
|
fi
|
2019-10-07 20:11:35 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
vendor_tmp=$(find /dev/block -type l -name vendor${SLOT} | head -n 1)
|
|
|
|
echo " INFO: #6 [vendor_tmp] ${vendor_tmp}"
|
|
|
|
VENDOR_BLOCK=$(readlink -f ${vendor_tmp})
|
|
|
|
echo " INFO: #7 [VENDOR_BLOCK] ${VENDOR_BLOCK}"
|
2019-10-25 18:47:43 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
! is_mounted /vendor && mount -o ro /vendor || mount -o ro ${VENDOR_BLOCK} /vendor
|
2019-10-07 19:33:09 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
if [ -d /system/vendor ]; then
|
|
|
|
### XXX work-around required for some ROMs
|
|
|
|
VENDOR_COMPAT=TRUE
|
|
|
|
ln -sf /system/vendor /vendor >/dev/null
|
|
|
|
fi
|
2019-10-23 18:55:31 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
echo " "
|
|
|
|
mount | awk '{print $1 " on " $3 " params: " $6}'
|
|
|
|
echo " "
|
2019-10-23 18:55:31 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
echo " INFO: #8 [prop]"
|
|
|
|
ls -l /system/*.prop
|
2018-08-29 15:00:56 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
export build_props=$(find /system /system_root /vendor -type f -name build.prop)
|
|
|
|
echo " INFO: #9 [build_props] ${build_props}"
|
2019-10-23 19:33:35 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
[ -z "${build_props}" ] && error "failed to mount /system (unsupported A/B device?)"
|
2019-10-23 18:52:43 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
[ -d /system/apex ] && mount_apex
|
|
|
|
fi
|
2018-02-15 16:50:33 +00:00
|
|
|
}
|
|
|
|
|
2020-08-20 20:11:24 +00:00
|
|
|
umount_partitions () {
|
|
|
|
umount -l /system_root 2>/dev/null
|
|
|
|
umount -l /system 2>/dev/null
|
|
|
|
umount -l /system/vendor 2>/dev/null
|
|
|
|
umount -l /vendor 2>/dev/null
|
|
|
|
umount -l /dev/random 2>/dev/null
|
|
|
|
|
|
|
|
mount | awk '/ \/apex/{print $3}' | while read apex_mount; do
|
|
|
|
umount -l "${apex_mount}" 2>/dev/null
|
|
|
|
done
|
|
|
|
|
|
|
|
mount | awk '/ \/apex/{print $1}' | while read apex_loop; do
|
|
|
|
losetup -d "${apex_loop}" 2>/dev/null
|
|
|
|
done
|
|
|
|
|
|
|
|
rm -rf /apex
|
|
|
|
|
|
|
|
unset ANDROID_RUNTIME_ROOT
|
|
|
|
unset ANDROID_TZDATA_ROOT
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
detect_mode () {
|
|
|
|
case "${nanodroid_forcesystem}" in
|
2018-01-28 10:31:15 +00:00
|
|
|
1 )
|
2018-09-04 18:30:23 +00:00
|
|
|
MODE_DETECT=forced
|
2018-09-07 16:27:53 +00:00
|
|
|
MODE=SYSTEM
|
2018-01-28 10:31:15 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
0 | *)
|
2019-05-12 08:47:23 +00:00
|
|
|
MODE=SYSTEM
|
2018-09-04 18:30:23 +00:00
|
|
|
MODE_DETECT=detected
|
|
|
|
|
2019-05-12 08:47:23 +00:00
|
|
|
for magisk in /data/adb/magisk/magisk /data/magisk/magisk \
|
|
|
|
/data/.magisk/magisk /data/adb/modules; do
|
|
|
|
if [ -e ${magisk} ]; then
|
|
|
|
MODE=MAGISK
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-03-01 13:28:04 +00:00
|
|
|
if [ -f "${NANODROID_LIST}" ]; then
|
|
|
|
MODE=SYSTEM
|
2019-05-12 08:47:23 +00:00
|
|
|
NANODROID_UPGRADE=1
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Mode | ${MODE} | ${MODE_DETECT}"
|
|
|
|
print_info " "
|
2018-09-04 18:22:11 +00:00
|
|
|
|
2019-05-12 08:47:23 +00:00
|
|
|
case ${MODE} in
|
|
|
|
SYSTEM )
|
2019-10-27 20:01:34 +00:00
|
|
|
recovery_setup_env
|
2019-05-12 08:47:23 +00:00
|
|
|
unset MODPATH
|
|
|
|
;;
|
2018-03-18 19:15:17 +00:00
|
|
|
|
2019-05-12 08:47:23 +00:00
|
|
|
MAGISK )
|
|
|
|
magisk_install_setup
|
2018-11-09 20:11:57 +00:00
|
|
|
|
2019-05-12 08:47:23 +00:00
|
|
|
case ${MODID} in
|
|
|
|
NanoDroid | NanoDroid_microG )
|
|
|
|
magisk_install_preinst
|
|
|
|
;;
|
|
|
|
esac
|
2018-08-19 16:46:55 +00:00
|
|
|
|
2020-08-18 16:13:09 +00:00
|
|
|
${BOOTMODE} || rm -rf "${MODPATH}"
|
2019-05-12 08:47:23 +00:00
|
|
|
;;
|
|
|
|
esac
|
2019-05-12 20:36:32 +00:00
|
|
|
|
|
|
|
[ "${ROM_NO_XBIN}" -eq 1 ] && \
|
|
|
|
NANODROID_BINDIR="${MODPATH}/system/bin" || \
|
|
|
|
NANODROID_BINDIR="${MODPATH}/system/xbin"
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2019-07-01 17:13:28 +00:00
|
|
|
detect_migrate_microg () {
|
2019-07-06 19:05:38 +00:00
|
|
|
GMSCORE_PATH=$(find /data/app -type d -name 'com.google.android.gms-*' 2>/dev/null)
|
2019-07-01 17:13:28 +00:00
|
|
|
|
2019-07-03 15:47:18 +00:00
|
|
|
if [ ! -z ${GMSCORE_PATH} ]; then
|
2020-07-31 18:32:04 +00:00
|
|
|
if [ -n "${1}" ]; then
|
|
|
|
if ! ${UNZIP} -l "${GMSCORE_PATH}/base.apk" | grep META-INF/NANOLX.RSA 2>/dev/null; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " + Removing Official microG GmsCore in favor of NanoDroid microG GmsCore"
|
2020-07-31 18:32:04 +00:00
|
|
|
rm -rf "${GMSCORE_PATH}"
|
2019-07-08 18:34:40 +00:00
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " + Resetting GCM/FCM connection of all apps to allow re-registration"
|
2020-07-31 18:32:04 +00:00
|
|
|
find /data/data/*/shared_prefs -name com.google.android.gms.*.xml -delete
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
if ${UNZIP} -l "${GMSCORE_PATH}/base.apk" | grep META-INF/NANOLX.RSA 2>/dev/null; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " + Removing NanoDroid microG GmsCore in favor of Official microG GmsCore"
|
2020-07-31 18:32:04 +00:00
|
|
|
rm -rf "${GMSCORE_PATH}"
|
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " + Resetting GCM/FCM connection of all apps to allow re-registration"
|
2020-07-31 18:32:04 +00:00
|
|
|
find /data/data/*/shared_prefs -name com.google.android.gms.*.xml -delete
|
|
|
|
fi
|
2019-07-01 17:13:28 +00:00
|
|
|
fi
|
|
|
|
fi
|
2020-07-31 18:32:04 +00:00
|
|
|
}
|
2019-07-01 17:13:28 +00:00
|
|
|
|
2020-07-31 18:32:04 +00:00
|
|
|
detect_migrate_droidguard () {
|
2019-07-06 19:05:38 +00:00
|
|
|
DROIDGUARD_PATH=$(find /data/app -type d -name 'org.microg.gms.droidguard-*' 2>/dev/null)
|
|
|
|
|
|
|
|
if [ ! -z ${DROIDGUARD_PATH} ]; then
|
2020-07-31 18:32:04 +00:00
|
|
|
if [ -n "${1}" ]; then
|
|
|
|
if ! ${UNZIP} -l "${DROIDGUARD_PATH}/base.apk" | grep META-INF/NANOLX.RSA 2>/dev/null; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " + Removing Official DroidGuard in favor of NanoDroid DroidGuard"
|
|
|
|
rm -rf "${DROIDGUARD_PATH}"
|
2020-07-31 18:32:04 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
if ${UNZIP} -l "${DROIDGUARD_PATH}/base.apk" | grep META-INF/NANOLX.RSA 2>/dev/null; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " + Removing NanoDroid DroidGuard in favor of Official DroidGuard"
|
2020-07-31 18:32:04 +00:00
|
|
|
rm -rf "${DROIDGUARD_PATH}"
|
|
|
|
fi
|
2019-07-06 19:05:38 +00:00
|
|
|
fi
|
2019-07-01 17:13:28 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
unpack_zip () {
|
|
|
|
TMPDIR=/dev/tmp
|
|
|
|
TMP_LIBDIR=${TMPDIR}/nanodroid-lib
|
|
|
|
INSTALLER=${TMPDIR}/install
|
|
|
|
|
|
|
|
rm -rf ${INSTALLER}
|
2018-09-07 16:21:48 +00:00
|
|
|
mkdir -p ${INSTALLER} || error "failed to prepare environment!"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > prepare installation"
|
2019-04-25 18:49:26 +00:00
|
|
|
unzip -oq "${ZIP}" -d "${INSTALLER}" || \
|
2018-09-07 16:21:48 +00:00
|
|
|
error "failed to prepare environment!"
|
2019-02-04 19:00:54 +00:00
|
|
|
|
|
|
|
rm -rf ${TMPDIR}/framework-res
|
2019-05-23 17:13:13 +00:00
|
|
|
rm -f ${TMPDIR}/*.xml
|
|
|
|
rm -f ${TMPDIR}/*.list
|
2019-10-27 20:01:34 +00:00
|
|
|
|
2020-08-11 19:25:48 +00:00
|
|
|
chmod 0755 ${INSTALLER}/*.*
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nanodroid_finalize () {
|
2018-04-20 18:05:48 +00:00
|
|
|
case ${MODID} in
|
|
|
|
NanoDroid | NanoDroid_microG )
|
|
|
|
if [ "${nanodroid_overlay}" -eq 1 ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with /system applications overlays"
|
2018-08-19 16:46:55 +00:00
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --create
|
2018-04-20 18:05:48 +00:00
|
|
|
else
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << without /system applications overlays"
|
2018-04-20 18:05:48 +00:00
|
|
|
fi
|
2018-04-22 18:47:14 +00:00
|
|
|
;;
|
2018-04-22 18:08:38 +00:00
|
|
|
esac
|
2018-04-20 18:05:48 +00:00
|
|
|
|
2019-10-14 15:10:08 +00:00
|
|
|
# required on Android 10, else all apps bundled with NanoDroid will not
|
|
|
|
# show a permission prompt for android.permission.WRITE_EXTERNAL_STORAGE
|
|
|
|
if [ "${SDK_VERSION}" -ge 29 -a ! -f /data/adb/.nanodroid_runtimeclean ]; then
|
2019-10-13 20:35:45 +00:00
|
|
|
find /data/system/users -type f -name 'runtime-permissions.xml' 2>/dev/null | while read file; do
|
|
|
|
rm -f "${file}"
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ resetting permissions: ${file}"
|
2019-10-13 20:35:45 +00:00
|
|
|
done
|
2019-10-14 15:10:08 +00:00
|
|
|
|
|
|
|
touch /data/adb/.nanodroid_runtimeclean
|
2019-10-13 20:35:45 +00:00
|
|
|
fi
|
|
|
|
|
2018-04-10 18:31:28 +00:00
|
|
|
if [ "${MODE}" = "MAGISK" ]; then
|
|
|
|
magisk_install_finish
|
|
|
|
else
|
|
|
|
install_addond
|
2019-10-23 20:05:21 +00:00
|
|
|
sync
|
|
|
|
nanodroid_storelogs
|
2018-04-10 18:31:28 +00:00
|
|
|
|
2018-08-21 19:59:15 +00:00
|
|
|
sort ${NANODROID_LIST} | uniq > /tmp/nanodroid-list
|
|
|
|
mv /tmp/nanodroid-list ${NANODROID_LIST}
|
2019-10-23 20:05:21 +00:00
|
|
|
|
2019-10-27 20:01:34 +00:00
|
|
|
recovery_cleanup_env
|
2018-04-10 18:31:28 +00:00
|
|
|
fi
|
2018-04-10 17:58:45 +00:00
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " "
|
|
|
|
print_info " Thanks for using NanoDroid "
|
|
|
|
print_info " "
|
2018-02-20 17:59:32 +00:00
|
|
|
|
2020-08-20 20:11:24 +00:00
|
|
|
${BOOTMODE} || umount_partitions
|
2020-04-17 18:45:32 +00:00
|
|
|
|
2020-08-18 16:13:09 +00:00
|
|
|
rm -rf ${INSTALLER}
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
##########################################################################################
|
|
|
|
# Architecture detection
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
detect_arch () {
|
|
|
|
SDK_VERSION=$(grep_prop ro.build.version.sdk)
|
|
|
|
|
|
|
|
ABI=$(grep_prop ro.product.cpu.abi | cut -c-3)
|
|
|
|
ABI2=$(grep_prop ro.product.cpu.abi2 | cut -c-3)
|
|
|
|
ABILONG=$(grep_prop ro.product.cpu.abi)
|
|
|
|
|
|
|
|
ARCH=arm
|
|
|
|
|
|
|
|
[ "$ABI" = "x86" ] && ARCH=x86
|
|
|
|
[ "$ABI2" = "x86" ] && ARCH=x86
|
|
|
|
[ "$ABILONG" = "arm64-v8a" ] && ARCH=arm64
|
2018-10-16 18:18:29 +00:00
|
|
|
[ "$ABILONG" = "x86_64" ] && ARCH=x86_64
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
case ${ARCH} in
|
|
|
|
arm ) BIN_ARCH="arm"
|
|
|
|
LIB_ARCHES="armeabi-v7a armeabi"
|
|
|
|
SWIPE_LIBDIR=lib ;;
|
|
|
|
arm64 ) BIN_ARCH="arm"
|
|
|
|
LIB_ARCHES="arm64-v8a armeabi-v7a armeabi"
|
|
|
|
SWIPE_LIBDIR=lib64 ;;
|
|
|
|
x86 ) BIN_ARCH="x86"
|
|
|
|
LIB_ARCHES="x86 armeabi-v7a armeabi"
|
|
|
|
SWIPE_LIBDIR=lib ;;
|
|
|
|
x86_64 ) BIN_ARCH="x86"
|
|
|
|
LIB_ARCHES="x86_64 x86 armeabi-v7a armeabi"
|
|
|
|
SWIPE_LIBDIR=lib64 ;;
|
|
|
|
esac
|
|
|
|
|
2019-06-26 18:50:52 +00:00
|
|
|
UNZIP="${INSTALLER}/unzip.${BIN_ARCH}"
|
2019-05-21 20:29:57 +00:00
|
|
|
chmod +x "${UNZIP}"
|
|
|
|
|
2019-05-23 16:56:37 +00:00
|
|
|
AAPT="${INSTALLER}/aapt.${BIN_ARCH}"
|
2019-05-21 20:29:57 +00:00
|
|
|
chmod +x "${AAPT}"
|
2018-01-26 14:32:52 +00:00
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
case ${SDK_VERSION} in
|
|
|
|
19 ) GSYNC_VER=K ;;
|
|
|
|
21 | 22 ) GSYNC_VER=L ;;
|
|
|
|
23 ) GSYNC_VER=M ;;
|
|
|
|
24 | 25 ) GSYNC_VER=N ;;
|
|
|
|
26 | 27 ) GSYNC_VER=O ;;
|
2018-08-31 18:03:52 +00:00
|
|
|
28 ) GSYNC_VER=P ;;
|
2020-01-27 17:10:23 +00:00
|
|
|
29 ) GSYNC_VER=Q ;;
|
2018-01-23 20:11:52 +00:00
|
|
|
* ) GSYNC_UNSUPPORTED=1 ;;
|
|
|
|
esac
|
|
|
|
|
2018-10-31 19:35:39 +00:00
|
|
|
|
|
|
|
case ${ARCH} in
|
|
|
|
arm )
|
|
|
|
case ${SDK_VERSION} in
|
2020-01-27 17:15:14 +00:00
|
|
|
29 )
|
|
|
|
LIBJNI_IME=libjni_latinimegoogle.so_28
|
|
|
|
;;
|
2018-10-31 19:35:39 +00:00
|
|
|
19 | 21 | 22 | 23 | 27 | 28 )
|
2018-10-31 20:04:32 +00:00
|
|
|
LIBJNI_IME=libjni_latinimegoogle.so_${SDK_VERSION}
|
2018-10-31 19:35:39 +00:00
|
|
|
;;
|
|
|
|
24 | 25 | 26 )
|
2018-10-31 20:04:32 +00:00
|
|
|
LIBJNI_IME=libjni_latinimegoogle.so_23
|
2018-10-31 19:35:39 +00:00
|
|
|
;;
|
|
|
|
* )
|
|
|
|
SWIPE_UNSUPPORTED=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
arm64 )
|
|
|
|
case ${SDK_VERSION} in
|
2020-01-27 17:15:14 +00:00
|
|
|
29 )
|
|
|
|
LIBJNI_IME=libjni_latinimegoogle.so_28
|
|
|
|
;;
|
2018-10-31 19:35:39 +00:00
|
|
|
21 | 22 | 23 | 27 | 28 )
|
2018-10-31 20:04:32 +00:00
|
|
|
LIBJNI_IME=libjni_latinimegoogle.so_${SDK_VERSION}
|
2018-10-31 19:35:39 +00:00
|
|
|
;;
|
|
|
|
24 | 25 | 26 )
|
2018-10-31 20:04:32 +00:00
|
|
|
LIBJNI_IME=libjni_latinimegoogle.so_23
|
2018-10-31 19:35:39 +00:00
|
|
|
;;
|
|
|
|
* )
|
|
|
|
SWIPE_UNSUPPORTED=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
|
|
|
|
x86 | x86_64 )
|
|
|
|
case ${SDK_VERSION} in
|
|
|
|
19 | 21 | 22 )
|
|
|
|
SWIPE_UNSUPPORTED=1
|
|
|
|
;;
|
2020-01-27 17:15:14 +00:00
|
|
|
23 | 24 | 25 | 26 | 27 | 28 | 29 )
|
2018-10-31 20:04:32 +00:00
|
|
|
LIBJNI_IME=libjni_latinimegoogle.so
|
2018-10-31 19:35:39 +00:00
|
|
|
;;
|
|
|
|
* )
|
|
|
|
SWIPE_UNSUPPORTED=1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
if [[ "${SDK_VERSION}" -lt 21 ]]; then
|
|
|
|
UNFOLD_APP_DIR=1
|
|
|
|
else UNFOLD_APP_DIR=0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "${SDK_VERSION}" -lt 19 ]]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " "
|
|
|
|
print_info " ++ Installing on pre-KitKat ROM, full"
|
|
|
|
print_info " ++ compatibility is not garantueed!"
|
|
|
|
print_info " "
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
2018-03-28 18:14:04 +00:00
|
|
|
|
|
|
|
if [ ! -d /system/xbin ]; then
|
|
|
|
ROM_NO_XBIN=1
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ ROM has no /system/xbin, using /system/bin instead"
|
2019-05-12 20:24:38 +00:00
|
|
|
else ROM_NO_XBIN=0
|
2018-03-28 18:14:04 +00:00
|
|
|
fi
|
2018-04-09 18:22:48 +00:00
|
|
|
|
|
|
|
[ ! -d /data/adb ] && mkdir /data/adb
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2018-08-20 18:46:41 +00:00
|
|
|
setup_busybox () {
|
|
|
|
mkdir -p ${INSTALLER}/busybox
|
|
|
|
ln -s ${INSTALLER}/busybox.${BIN_ARCH} ${INSTALLER}/busybox/busybox
|
|
|
|
|
2018-09-01 09:23:15 +00:00
|
|
|
chmod 0755 ${INSTALLER}/busybox.${BIN_ARCH}
|
2018-08-20 18:46:41 +00:00
|
|
|
${INSTALLER}/busybox.${BIN_ARCH} --install -s ${INSTALLER}/busybox/
|
|
|
|
}
|
|
|
|
|
2018-08-18 19:12:46 +00:00
|
|
|
# Taken from Magisk, used for System Mode installation
|
2019-10-27 20:01:34 +00:00
|
|
|
recovery_setup_env () {
|
2020-08-20 21:34:33 +00:00
|
|
|
if ${BOOTMODE}; then
|
|
|
|
PATH=${INSTALLER}/busybox:/system/bin:/vendor/bin
|
|
|
|
else
|
|
|
|
OLD_PATH=${PATH}
|
|
|
|
OLD_LD_LIB=${LD_LIBRARY_PATH}
|
|
|
|
OLD_LD_PRE=${LD_PRELOAD}
|
|
|
|
OLD_LD_CFG=${LD_CONFIG_FILE}
|
|
|
|
unset LD_LIBRARY_PATH
|
|
|
|
unset LD_PRELOAD
|
|
|
|
unset LD_CONFIG_FILE
|
|
|
|
PATH=${INSTALLER}/busybox:/system/bin:/vendor/bin
|
|
|
|
fi
|
2018-08-18 19:12:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Taken from Magisk, used for System Mode installation
|
2019-10-27 20:01:34 +00:00
|
|
|
recovery_cleanup_env () {
|
2020-08-20 21:34:33 +00:00
|
|
|
if ${BOOTMODE}; then
|
|
|
|
[ -n ${OLD_PATH} ] && PATH=${OLD_PATH}
|
|
|
|
else
|
|
|
|
[ -n ${OLD_PATH} ] && PATH=${OLD_PATH}
|
|
|
|
[ -n ${OLD_LD_LIB} ] && LD_LIBRARY_PATH=${OLD_LD_LIB}
|
|
|
|
[ -n ${OLD_LD_PRE} ] && LD_PRELOAD=${OLD_LD_PRE}
|
|
|
|
[ -n ${OLD_LD_CFG} ] && LD_CONFIG_FILE=${OLD_LD_CFG}
|
|
|
|
fi
|
2018-08-18 19:12:46 +00:00
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Magisk Mode Installation
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
magisk_install_setup () {
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " "
|
|
|
|
print_info "******************************"
|
|
|
|
print_info "Powered by Magisk (@topjohnwu)"
|
|
|
|
print_info "******************************"
|
|
|
|
print_info " "
|
|
|
|
print_info " > setup Magisk environment"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-12-22 17:46:34 +00:00
|
|
|
if [ -f /data/adb/magisk/util_functions.sh ]; then
|
|
|
|
. /data/adb/magisk/util_functions.sh
|
|
|
|
else
|
2020-08-18 16:13:09 +00:00
|
|
|
error "Could not load Magisk util_functions.sh"
|
2018-12-22 17:46:34 +00:00
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-03-28 19:09:41 +00:00
|
|
|
if [ ${MAGISK_VER_CODE} -gt 18100 ]; then
|
2020-08-18 18:56:12 +00:00
|
|
|
MAGIKSBASE=/data/adb
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2020-08-18 16:13:09 +00:00
|
|
|
${BOOTMODE} && \
|
2020-08-18 18:56:12 +00:00
|
|
|
MODPATH=${MAGIKSBASE}/modules_update/${MODID} || \
|
|
|
|
MODPATH=${MAGIKSBASE}/modules/${MODID}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-10-27 20:01:34 +00:00
|
|
|
recovery_setup_env
|
2019-03-28 19:09:41 +00:00
|
|
|
else
|
2019-05-11 20:22:28 +00:00
|
|
|
error "Magisk version 19.0 or newer is required"
|
2019-02-04 19:00:54 +00:00
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
case ${MODID} in
|
|
|
|
NanoDroid )
|
2018-08-22 18:01:37 +00:00
|
|
|
# check for sub-modules which are not
|
|
|
|
# supposed to be installed alongside
|
|
|
|
for dir in NanoDroid_microG NanoDroid_FDroid; do
|
2020-08-18 18:56:12 +00:00
|
|
|
if [ -d ${MAGIKSBASE}/modules/${dir} ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " !! ${dir} module detected - uninstalling!"
|
2020-08-18 18:56:12 +00:00
|
|
|
rm -rf ${MAGIKSBASE}/modules/${dir}
|
|
|
|
NANODROID_UPGRADE=1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ${MAGIKSBASE}/modules_update/${dir} ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " !! ${dir} module detected - uninstalling!"
|
2020-08-18 18:56:12 +00:00
|
|
|
rm -rf ${MAGIKSBASE}/modules_update/${dir}
|
2018-08-04 18:23:59 +00:00
|
|
|
NANODROID_UPGRADE=1
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
|
2018-09-08 17:05:01 +00:00
|
|
|
NanoDroid_microG | NanoDroid_FDroid )
|
2018-01-23 20:11:52 +00:00
|
|
|
# check for Full package and abort if found
|
2020-08-18 18:56:12 +00:00
|
|
|
[ -d ${MAGIKSBASE}/modules/NanoDroid -o -d ${MAGIKSBASE}/modules_update/NanoDroid ] && \
|
2018-09-07 16:21:48 +00:00
|
|
|
error "${MODID} can't be installed along side the Full package"
|
2018-08-04 18:23:59 +00:00
|
|
|
;;
|
|
|
|
|
2020-02-07 19:19:52 +00:00
|
|
|
NanoDroid_OsmAnd | NanoDroid_Google | NanoDroid_BromiteWebView )
|
2018-11-08 17:46:56 +00:00
|
|
|
true
|
|
|
|
;;
|
|
|
|
|
2018-08-04 18:23:59 +00:00
|
|
|
* )
|
|
|
|
error "unknown module intended to be installed!?"
|
2018-01-23 20:11:52 +00:00
|
|
|
;;
|
|
|
|
esac
|
2018-09-08 17:05:01 +00:00
|
|
|
|
2020-08-18 16:13:09 +00:00
|
|
|
[ -d ${MODPATH} -o -d ${OVERLAYPATH} ] && NANODROID_UPGRADE=1
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
magisk_install_preinst () {
|
2018-11-10 21:03:23 +00:00
|
|
|
if [ -f ${MODPATH}/system.prop ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << backing up module's system.prop"
|
2018-11-10 21:03:23 +00:00
|
|
|
cp ${MODPATH}/system.prop ${TMPDIR}/system.prop
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-10 21:03:23 +00:00
|
|
|
if [ -f ${MODPATH}/system/framework/services.jar ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << backing up patched services.jar"
|
2018-11-10 21:03:23 +00:00
|
|
|
cp ${MODPATH}/system/framework/services.jar ${TMPDIR}/services.jar
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
2019-05-05 18:27:37 +00:00
|
|
|
|
2020-08-23 10:21:44 +00:00
|
|
|
if [ -f ${MODPATH}/system/framework/org.spoofing.apk ]; then
|
|
|
|
print_info " << backing up org.spoofing.apk"
|
|
|
|
cp ${MODPATH}/system/framework/org.spoofing.apk ${TMPDIR}/org.spoofing.apk
|
|
|
|
fi
|
|
|
|
|
2019-05-05 18:27:37 +00:00
|
|
|
if [ -d ${MODPATH}/logs ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << backing up init.d script logs"
|
2019-05-05 18:27:37 +00:00
|
|
|
cp -r ${MODPATH}/logs ${TMPDIR}/logs
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ${MODPATH}/logcats ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << backing up logcats"
|
2019-05-05 18:27:37 +00:00
|
|
|
cp -r ${MODPATH}/logcats ${TMPDIR}/logcats
|
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
magisk_install_postinst () {
|
|
|
|
if [ -f ${TMPDIR}/system.prop ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << restoring system.prop"
|
2018-08-21 20:33:53 +00:00
|
|
|
cp ${TMPDIR}/system.prop ${MODPATH}/system.prop
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
|
2018-12-25 20:59:45 +00:00
|
|
|
if [ "${nanodroid_microg}" -ne 0 -o "${MODID}" = "NanoDroid_microG" ]; then
|
2018-12-27 21:01:34 +00:00
|
|
|
if [ ! -z $(grep_prop ro.setupwizard.mode) ]; then
|
|
|
|
echo "ro.setupwizard.mode=DISABLED" >> ${MODPATH}/system.prop
|
2018-12-25 20:59:45 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2019-05-05 18:27:37 +00:00
|
|
|
if [ -d ${TMPDIR}/logs ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << restoring init.d script logs"
|
2019-05-05 18:27:37 +00:00
|
|
|
cp -r ${TMPDIR}/logs ${MODPATH}/logs
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -d ${TMPDIR}/logcats ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << restoring logcats"
|
2019-05-05 18:27:37 +00:00
|
|
|
cp -r ${TMPDIR}/logcats ${MODPATH}/logcats
|
|
|
|
fi
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
if [ -f ${TMPDIR}/services.jar ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << restoring patched services.jar"
|
2018-01-23 20:11:52 +00:00
|
|
|
mkdir -p ${MODPATH}/system/framework
|
2018-08-21 20:33:53 +00:00
|
|
|
cp ${TMPDIR}/services.jar ${MODPATH}/system/framework/services.jar
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
2020-08-23 10:21:44 +00:00
|
|
|
|
|
|
|
if [ -f ${TMPDIR}/org.spoofing.apk ]; then
|
|
|
|
print_info " << restoring org.spoofing.apk"
|
|
|
|
mkdir -p ${MODPATH}/system/framework
|
|
|
|
cp ${TMPDIR}/org.spoofing.apk ${MODPATH}/system/framework/org.spoofing.apk
|
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
magisk_install_finish () {
|
|
|
|
# Magisk Module files
|
|
|
|
cp -af ${INSTALLER}/module.prop ${MODPATH}/module.prop
|
2018-02-09 16:09:36 +00:00
|
|
|
|
2019-04-03 19:52:35 +00:00
|
|
|
if [ -f ${INSTALLER}/service.sh ]; then
|
|
|
|
cp -af ${INSTALLER}/service.sh ${MODPATH}/service.sh
|
2018-02-09 16:09:36 +00:00
|
|
|
chmod +x ${MODPATH}/service.sh
|
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
case ${MODID} in
|
|
|
|
NanoDroid | NanoDroid_microG )
|
|
|
|
magisk_install_postinst
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2020-08-18 18:56:12 +00:00
|
|
|
${BOOTMODE} && touch ${MAGIKSBASE}/modules/${MODID}/update
|
2020-08-18 16:13:09 +00:00
|
|
|
|
2019-10-23 20:05:21 +00:00
|
|
|
sync
|
|
|
|
nanodroid_storelogs
|
2020-08-20 21:34:33 +00:00
|
|
|
recovery_cleanup_env
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2018-12-27 21:01:34 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Destroy all GApps!
|
|
|
|
##########################################################################################
|
|
|
|
|
2018-12-01 19:10:33 +00:00
|
|
|
gapps_solve_conflicts () {
|
|
|
|
# first get rid of conflicting packages
|
2019-02-04 19:00:54 +00:00
|
|
|
print_google_apps | while read app; do
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ removing app: ${app} [google_apps]"
|
2018-12-01 19:10:33 +00:00
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add ${app}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-12-01 19:10:33 +00:00
|
|
|
rm -rf /data/dalvik-cache/*/system"@priv-app@${app}"[@\.]*@classes.*
|
|
|
|
rm -rf /data/dalvik-cache/*/system"@app@${app}"[@\.]*@classes.*
|
|
|
|
done
|
2018-04-02 16:59:07 +00:00
|
|
|
|
2019-02-04 19:00:54 +00:00
|
|
|
print_google_data | while read app; do
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ removing data for: ${app} [google_data]"
|
2018-12-01 19:10:33 +00:00
|
|
|
rm -rf /data/data/${app}
|
|
|
|
rm -rf /data/user/*/${app}
|
|
|
|
rm -rf /data/user_de/*/${app}
|
|
|
|
rm -rf /data/app/${app}-*
|
|
|
|
rm -rf /mnt/asec/${app}-*
|
2019-05-05 10:17:26 +00:00
|
|
|
rm -rf ${STORAGE}/Android/data/${app}
|
2018-12-01 19:10:33 +00:00
|
|
|
done
|
|
|
|
}
|
2018-07-08 15:21:02 +00:00
|
|
|
|
2018-12-01 19:10:33 +00:00
|
|
|
gapps_destroy_artifacts () {
|
|
|
|
# this removes original Play Services
|
|
|
|
# only if this is a fresh NanoDroid installation
|
|
|
|
if [ "${NANODROID_UPGRADE}" -eq 0 ]; then
|
|
|
|
rm -rf /data/dalvik-cache/*/system"@priv-app@GmsCore"[@\.]*@classes.*
|
2018-07-08 15:21:02 +00:00
|
|
|
|
2019-02-04 19:00:54 +00:00
|
|
|
print_google_data_dirty | while read app; do
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ removing data for: ${app} [google_data_dirty]"
|
2018-07-08 15:21:02 +00:00
|
|
|
rm -rf /data/data/${app}
|
|
|
|
rm -rf /data/user/*/${app}
|
|
|
|
rm -rf /data/user_de/*/${app}
|
|
|
|
rm -rf /data/app/${app}-*
|
2018-10-11 16:50:51 +00:00
|
|
|
rm -rf /mnt/asec/${app}-*
|
2019-05-05 10:17:26 +00:00
|
|
|
rm -rf ${STORAGE}/Android/data/${app}
|
2018-04-22 18:47:14 +00:00
|
|
|
done
|
2018-04-02 16:59:07 +00:00
|
|
|
|
2018-12-03 19:33:00 +00:00
|
|
|
find /data/system* -type f -name 'accounts*db' 2>/dev/null | while read database; do
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ deleting Google Accounts from ${database} (if any)"
|
2018-12-01 19:10:33 +00:00
|
|
|
${INSTALLER}/sqlite3.${BIN_ARCH} ${database} \
|
|
|
|
"DELETE FROM accounts WHERE type='com.google';"
|
|
|
|
done
|
|
|
|
|
2018-12-03 19:33:00 +00:00
|
|
|
find /data/system/users -type f -name 'runtime-permissions.xml' 2>/dev/null | while read file; do
|
2018-12-01 19:10:33 +00:00
|
|
|
if grep -q "com.google.android" "${file}"; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ resetting permissions: ${file}"
|
2018-12-01 19:10:33 +00:00
|
|
|
rm -f "${file}"
|
|
|
|
fi
|
|
|
|
done
|
2018-07-08 15:21:02 +00:00
|
|
|
|
2018-12-01 19:10:33 +00:00
|
|
|
if [ -f /data/system/packages.list ]; then
|
2019-02-04 19:00:54 +00:00
|
|
|
print_google_data_dirty | while read app; do
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ de-registering app: ${app} (if installed)"
|
2018-12-01 19:10:33 +00:00
|
|
|
sed -e "/${app}/d" -i /data/system/packages.list
|
2018-08-10 17:22:25 +00:00
|
|
|
done
|
2018-12-01 19:10:33 +00:00
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
2018-07-08 15:21:02 +00:00
|
|
|
|
2018-12-27 21:01:34 +00:00
|
|
|
##########################################################################################
|
2019-05-11 19:14:13 +00:00
|
|
|
# check if ROM has native fake signature spoofing support
|
2018-12-27 21:11:09 +00:00
|
|
|
# by @ale5000
|
2018-12-27 21:01:34 +00:00
|
|
|
##########################################################################################
|
|
|
|
|
2019-05-11 19:14:13 +00:00
|
|
|
check_fake_package_signature () {
|
2018-12-27 21:01:34 +00:00
|
|
|
PERMISSION=android.permission.FAKE_PACKAGE_SIGNATURE
|
|
|
|
PERMISSION_OD=$(echo -n "${PERMISSION}" | od -A n -t x1 | tr -d '\n' | sed -e 's/^ //g;s/ /00/g')
|
|
|
|
HAS_FAKESIGN=false
|
|
|
|
|
|
|
|
FW_RES_DIR="${TMPDIR}/framework-res"
|
2019-05-11 19:14:13 +00:00
|
|
|
FW_RES_FILE="${FW_RES_DIR}/AndroidManifest.xml"
|
2019-02-04 19:00:54 +00:00
|
|
|
|
2019-05-11 19:14:13 +00:00
|
|
|
if [ ! -f ${FW_RES_FILE} ]; then
|
2019-02-04 19:00:54 +00:00
|
|
|
mkdir -p "${FW_RES_DIR}"
|
2019-05-21 20:29:57 +00:00
|
|
|
"${UNZIP}" -oq /system/framework/framework-res.apk -d "${FW_RES_DIR}"
|
2019-02-04 19:00:54 +00:00
|
|
|
fi
|
2018-12-27 21:01:34 +00:00
|
|
|
|
2019-05-11 19:14:13 +00:00
|
|
|
grep -qF "${PERMISSION}" "${FW_RES_FILE}" && HAS_FAKESIGN=true
|
|
|
|
od -A n -t x1 "${FW_RES_FILE}" | tr -d ' \n' | grep -qF "${PERMISSION_OD}" && HAS_FAKESIGN=true
|
2018-12-27 21:01:34 +00:00
|
|
|
|
|
|
|
${HAS_FAKESIGN} && return 0 || return 1
|
|
|
|
}
|
|
|
|
|
2019-05-11 19:14:13 +00:00
|
|
|
##########################################################################################
|
|
|
|
# check if Bromite System WebView is supported
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
check_bromite_webview_support () {
|
|
|
|
WEBVIEW_PKG="com.android.webview"
|
|
|
|
HAS_WEBVIEW=false
|
|
|
|
|
2019-10-27 20:01:34 +00:00
|
|
|
${AAPT} dump xmltree /system/framework/framework-res.apk res/xml/config_webview_packages.xml | \
|
2019-10-27 19:41:19 +00:00
|
|
|
tr -d '\n' | sed -e 's/webviewprovider/\n/g' | grep com.android.webview | \
|
2019-10-27 19:43:05 +00:00
|
|
|
grep -q 'E: signature' || HAS_WEBVIEW=true
|
2019-05-11 19:14:13 +00:00
|
|
|
|
|
|
|
${HAS_WEBVIEW} && return 0 || return 1
|
|
|
|
}
|
|
|
|
|
2019-05-21 20:29:57 +00:00
|
|
|
##########################################################################################
|
|
|
|
# privapp permission whitelist generation
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
dump_system_privapp_permissions () {
|
2019-05-23 16:38:19 +00:00
|
|
|
SYS_LIST="${TMPDIR}/privapp-permissions.list"
|
|
|
|
|
2019-05-21 20:29:57 +00:00
|
|
|
# XXX this looks shitty
|
2019-05-23 17:18:49 +00:00
|
|
|
"${AAPT}" dump xmltree /system/framework/framework-res.apk AndroidManifest.xml | \
|
2020-01-08 18:01:04 +00:00
|
|
|
tr -d '\n' | sed -e 's/E:/\n/g' | \
|
2020-01-17 22:11:20 +00:00
|
|
|
grep '(type 0x11)0x[137]2' | \
|
2019-05-23 16:38:19 +00:00
|
|
|
awk -F\" '{print $2}' | sort > "${SYS_LIST}"
|
2019-05-21 20:29:57 +00:00
|
|
|
|
2020-01-17 22:11:20 +00:00
|
|
|
"${AAPT}" dump xmltree /system/framework/framework-res.apk AndroidManifest.xml | \
|
|
|
|
tr -d '\n' | sed -e 's/E:/\n/g' | \
|
|
|
|
grep '(type 0x11)0xc212' | \
|
|
|
|
awk -F\" '{print $2}' | sort >> "${SYS_LIST}"
|
|
|
|
|
2020-08-04 19:26:50 +00:00
|
|
|
"${AAPT}" dump xmltree /system/framework/framework-res.apk AndroidManifest.xml | \
|
|
|
|
tr -d '\n' | sed -e 's/E:/\n/g' | \
|
|
|
|
grep '(type 0x11)0x[02]' | \
|
|
|
|
awk -F\" '{print $2}' | sort >> "${SYS_LIST}"
|
|
|
|
|
|
|
|
"${AAPT}" dump xmltree /system/framework/framework-res.apk AndroidManifest.xml | \
|
|
|
|
tr -d '\n' | sed -e 's/E:/\n/g' | \
|
|
|
|
grep '(type 0x11)0x[13]02' | \
|
|
|
|
awk -F\" '{print $2}' | sort >> "${SYS_LIST}"
|
|
|
|
|
|
|
|
"${AAPT}" dump xmltree /system/framework/framework-res.apk AndroidManifest.xml | \
|
|
|
|
tr -d '\n' | sed -e 's/E:/\n/g' | \
|
|
|
|
grep '(type 0x11)0x1[01]2' | \
|
|
|
|
awk -F\" '{print $2}' | sort >> "${SYS_LIST}"
|
|
|
|
|
|
|
|
"${AAPT}" dump xmltree /system/framework/framework-res.apk AndroidManifest.xml | \
|
|
|
|
tr -d '\n' | sed -e 's/E:/\n/g' | \
|
|
|
|
grep '(type 0x11)0x1001' | \
|
|
|
|
awk -F\" '{print $2}' | sort >> "${SYS_LIST}"
|
|
|
|
|
2019-05-23 16:38:19 +00:00
|
|
|
# XXX pre-patched custom ROM
|
|
|
|
check_fake_package_signature && \
|
|
|
|
echo "android.permission.FAKE_PACKAGE_SIGNATURE" >> "${SYS_LIST}"
|
2019-05-21 20:29:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
create_privapp_permissions_whitelist () {
|
2019-05-23 16:38:19 +00:00
|
|
|
APK="${MODPATH}/system/priv-app/${1}/${1}.apk"
|
|
|
|
APK_NAME="$("${AAPT}" dump badging "${APK}" | awk -F \' '/^package: name/{print $2}')"
|
|
|
|
APK_LIST="${TMPDIR}/${APK_NAME}.list"
|
|
|
|
|
2019-05-21 20:29:57 +00:00
|
|
|
SYS_LIST="${TMPDIR}/privapp-permissions.list"
|
2019-05-23 16:38:19 +00:00
|
|
|
|
2019-05-21 20:29:57 +00:00
|
|
|
APP_WHITELIST="${TMPDIR}/${APK_NAME}.xml"
|
2019-06-05 19:28:11 +00:00
|
|
|
INST_WHITELIST="/system/etc/permissions/${APK_NAME}.xml"
|
2019-05-23 16:38:19 +00:00
|
|
|
|
|
|
|
[ ! -f "${SYS_LIST}" ] && dump_system_privapp_permissions
|
|
|
|
|
|
|
|
"${AAPT}" dump permissions "${APK}" | \
|
|
|
|
awk -F \' '/^uses-permission:/{print $2}' | \
|
2019-05-23 17:01:17 +00:00
|
|
|
sort > "${APK_LIST}"
|
2019-05-21 20:29:57 +00:00
|
|
|
|
|
|
|
echo '<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<permissions>
|
|
|
|
<privapp-permissions package="'${APK_NAME}'">' > "${APP_WHITELIST}"
|
|
|
|
|
|
|
|
cat "${APK_LIST}" | while read perm; do
|
|
|
|
if grep -q "${perm}" "${SYS_LIST}"; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " ++ package ${APK_NAME} needs privapp-whitelist ${perm}"
|
2019-05-21 20:29:57 +00:00
|
|
|
echo ' <permission name="'${perm}'" />' >> "${APP_WHITELIST}"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo ' </privapp-permissions>
|
|
|
|
</permissions>' >> "${APP_WHITELIST}"
|
2019-05-23 16:38:19 +00:00
|
|
|
|
|
|
|
mkdir -p "${MODPATH}/system/etc/permissions/"
|
2019-06-05 19:28:11 +00:00
|
|
|
cp "${APP_WHITELIST}" "${MODPATH}/${INST_WHITELIST}"
|
|
|
|
set_perm_data "${MODPATH}/${INST_WHITELIST}"
|
2019-05-23 16:38:19 +00:00
|
|
|
installinfo_add "${INST_WHITELIST}"
|
2019-05-21 20:29:57 +00:00
|
|
|
}
|
|
|
|
|
2018-12-01 19:10:33 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Generic Installation
|
|
|
|
##########################################################################################
|
2018-10-20 12:32:03 +00:00
|
|
|
|
2018-12-01 19:10:33 +00:00
|
|
|
install_microg () {
|
|
|
|
# install microG if requested
|
|
|
|
# respectively force if it's the microG package
|
|
|
|
if [ "${nanodroid_microg}" -ne 0 -o "${MODID}" = "NanoDroid_microG" ]; then
|
|
|
|
|
|
|
|
gapps_solve_conflicts
|
|
|
|
gapps_destroy_artifacts
|
2018-07-08 15:21:02 +00:00
|
|
|
|
2018-11-27 18:14:35 +00:00
|
|
|
NLPBACKEND="nlpBackendNominatim"
|
2019-01-05 23:31:05 +00:00
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with microg"
|
|
|
|
print_info " ++ Nominatim geocoder backend"
|
2019-03-01 14:03:21 +00:00
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add NominatimGeocoderBackend
|
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add NominatimNlpBackend
|
2018-11-27 18:14:35 +00:00
|
|
|
|
2018-11-27 19:20:47 +00:00
|
|
|
if [ "${nanodroid_nlpbackend:0:1}" -eq 1 ]; then
|
2018-11-27 18:14:35 +00:00
|
|
|
NLPBACKEND="${NLPBACKEND} nlpBackendDejavu"
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ++ Déjà Vu location backend"
|
2019-03-01 14:03:21 +00:00
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add DejaVuNlpBackend
|
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add DejaVuBackend
|
2018-11-27 18:14:35 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-27 19:20:47 +00:00
|
|
|
if [ "${nanodroid_nlpbackend:1:1}" -eq 1 ]; then
|
2018-11-27 18:14:35 +00:00
|
|
|
NLPBACKEND="${NLPBACKEND} nlpBackendIchnaea"
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ++ Ichnaea location backend"
|
2019-03-01 14:03:21 +00:00
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add IchnaeaNlpBackend
|
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add MozillaNlpBackend
|
2018-11-27 18:14:35 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-27 19:20:47 +00:00
|
|
|
if [ "${nanodroid_nlpbackend:2:1}" -eq 1 ]; then
|
2018-11-27 18:14:35 +00:00
|
|
|
NLPBACKEND="${NLPBACKEND} nlpBackendApple"
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ++ Apple location backend"
|
2018-11-27 18:14:35 +00:00
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-01-05 23:27:14 +00:00
|
|
|
if [ "${nanodroid_nlpbackend:3:1}" -eq 1 ]; then
|
2019-01-05 23:04:36 +00:00
|
|
|
NLPBACKEND="${NLPBACKEND} nlpBackendRadiocell"
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ++ Radiocell location backend"
|
2019-01-05 23:04:36 +00:00
|
|
|
fi
|
|
|
|
|
2019-07-06 18:31:36 +00:00
|
|
|
# migrate from Nanolx microG GmsCore to Official microG GmsCore
|
2019-07-01 17:13:28 +00:00
|
|
|
detect_migrate_microg
|
|
|
|
|
2020-07-31 18:32:04 +00:00
|
|
|
# migrate from Official DroidGuard to Nanolx DroidGuard
|
|
|
|
detect_migrate_droidguard reverse
|
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ++ microG GmsCore"
|
2019-07-06 18:31:36 +00:00
|
|
|
nanodroid_install_apk GmsCore
|
2018-11-20 17:04:35 +00:00
|
|
|
|
2018-11-07 16:25:25 +00:00
|
|
|
if [ "${nanodroid_microg}" -ne 2 ]; then
|
2019-02-03 16:00:21 +00:00
|
|
|
for app in GsfProxy DroidGuard; do
|
|
|
|
nanodroid_install_apk ${app}
|
|
|
|
done
|
2019-03-01 14:03:21 +00:00
|
|
|
|
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add GmsDroidGuard
|
2018-09-15 20:05:45 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-28 20:35:30 +00:00
|
|
|
for app in ${NLPBACKEND}; do
|
|
|
|
nanodroid_install_apk ${app}
|
|
|
|
done
|
|
|
|
|
2019-05-23 16:38:19 +00:00
|
|
|
create_privapp_permissions_whitelist GmsCore
|
2019-01-14 18:41:27 +00:00
|
|
|
|
2018-03-02 18:31:30 +00:00
|
|
|
nanodroid_install_file etc/permissions/features.xml
|
|
|
|
nanodroid_install_file etc/default-permissions/microg-permissions.xml
|
|
|
|
nanodroid_install_file etc/sysconfig/microg-a5k.xml
|
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without microG"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_mapsv1 () {
|
|
|
|
# install mapsv1 if requested
|
|
|
|
if [ "${nanodroid_mapsv1}" -eq 1 ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with Maps API version 1"
|
2018-03-02 18:31:30 +00:00
|
|
|
nanodroid_install_file etc/permissions/com.google.android.maps.xml
|
2018-11-06 20:55:39 +00:00
|
|
|
nanodroid_install_file framework/com.google.android.maps.jar
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without Maps API version 1"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_gsync () {
|
|
|
|
# install GSync if requested
|
|
|
|
if [ "${nanodroid_gsync}" -eq 1 ]; then
|
|
|
|
if [ "${GSYNC_UNSUPPORTED}" -eq 1 ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << Google Sync Adapters are unsupported on SDK ${SDK_VERSION}"
|
2018-01-23 20:11:52 +00:00
|
|
|
else
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with Google Sync Adapters (${GSYNC_VER})"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-11-12 10:41:13 +00:00
|
|
|
for app in GoogleCalendarSync GoogleContactsSync GoogleBackupTransport; do
|
2018-11-06 20:42:52 +00:00
|
|
|
nanodroid_install_apk ${app}
|
2018-01-23 20:11:52 +00:00
|
|
|
done
|
|
|
|
|
2019-05-23 16:38:19 +00:00
|
|
|
create_privapp_permissions_whitelist GoogleBackupTransport
|
2019-01-03 18:08:58 +00:00
|
|
|
nanodroid_install_file etc/default-permissions/google-sync-permissions.xml
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without Google Sync Adapters"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-08-18 19:20:19 +00:00
|
|
|
install_fdroid_aurora () {
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with Aurora Droid"
|
2020-08-18 19:20:19 +00:00
|
|
|
nanodroid_install_apk AuroraDroid
|
|
|
|
nanodroid_install_apk AuroraServices
|
|
|
|
create_privapp_permissions_whitelist AuroraServices
|
|
|
|
}
|
|
|
|
|
|
|
|
install_fdroid_fdroid () {
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with F-Droid"
|
2020-08-18 19:20:19 +00:00
|
|
|
nanodroid_install_apk FDroid
|
|
|
|
nanodroid_install_apk FDroidPrivileged
|
|
|
|
|
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add FDroidPriv
|
|
|
|
|
|
|
|
create_privapp_permissions_whitelist FDroidPrivileged
|
|
|
|
nanodroid_install_file etc/org.fdroid.fdroid/additional_repos.xml
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
install_fdroid () {
|
|
|
|
# install F-Droid if requested
|
|
|
|
# respectively force if it's the F-Droid package
|
2019-08-02 17:31:04 +00:00
|
|
|
|
2020-08-18 19:21:03 +00:00
|
|
|
if [ "${nanodroid_fdroid}" -eq 3 ]; then
|
2020-08-18 19:20:19 +00:00
|
|
|
install_fdroid_fdroid
|
|
|
|
install_fdroid_aurora
|
|
|
|
elif [ "${nanodroid_fdroid}" -eq 2 ]; then
|
|
|
|
install_fdroid_aurora
|
2019-08-02 17:31:04 +00:00
|
|
|
elif [ "${nanodroid_fdroid}" -eq 1 -o "${MODID}" = "NanoDroid_FDroid" ]; then
|
2020-08-18 19:20:19 +00:00
|
|
|
install_fdroid_fdroid
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without F-Droid"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_apps () {
|
|
|
|
# install apps if requested
|
|
|
|
if [ "${nanodroid_apps}" -eq 1 ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with applications"
|
2018-01-23 20:11:52 +00:00
|
|
|
APP_STRING=" <<>"
|
|
|
|
|
|
|
|
INSTALL_APPS=$(cat "${cfg_apps}")
|
|
|
|
for app in ${INSTALL_APPS}; do
|
2020-08-20 21:35:06 +00:00
|
|
|
if [[ -d /system/app/${app} && ! -d ${MAGIKSBASE}/modules/${MODID}/system/app/${app} ]]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ++ app: ${app} already provided by ROM"
|
2018-01-23 20:11:52 +00:00
|
|
|
elif [[ -d "${INSTALLER}/system/app/${app}" ]]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " ++ ${app}"
|
2018-01-23 20:11:52 +00:00
|
|
|
nanodroid_install_apk ${app}
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " ++ app: ${app} missing"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
done
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without applications"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2020-03-30 17:52:16 +00:00
|
|
|
install_store_play () {
|
|
|
|
# force unselect Fake Store when user has choosen Play Store
|
|
|
|
STORE_CONFLICT="FakeStore"
|
|
|
|
FAKE_STORE=0
|
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with Play Store"
|
2020-03-30 17:52:16 +00:00
|
|
|
nanodroid_install_apk Phonesky
|
|
|
|
|
|
|
|
create_privapp_permissions_whitelist Phonesky
|
|
|
|
|
|
|
|
nanodroid_install_file etc/default-permissions/phonesky-permissions.xml
|
|
|
|
}
|
|
|
|
|
|
|
|
install_store_aurora () {
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with Aurora Store"
|
2020-03-30 17:52:16 +00:00
|
|
|
nanodroid_install_apk AuroraStore
|
|
|
|
nanodroid_install_apk AuroraServices
|
|
|
|
create_privapp_permissions_whitelist AuroraServices
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
install_store () {
|
2018-11-27 19:20:47 +00:00
|
|
|
STORE_CHOICE=${nanodroid_play:0:1}
|
|
|
|
FAKE_STORE=${nanodroid_play:1:1}
|
2018-04-02 17:44:48 +00:00
|
|
|
|
2018-11-27 18:48:00 +00:00
|
|
|
[ "${FAKE_STORE}" -eq 1 ] && STORE_CONFLICT="Phonesky" || STORE_CONFLICT=""
|
|
|
|
|
2020-03-30 17:52:16 +00:00
|
|
|
# install Aurora and/or Play Store whichever requested
|
2018-11-27 18:48:00 +00:00
|
|
|
case "${STORE_CHOICE}" in
|
2018-04-02 17:44:48 +00:00
|
|
|
1 )
|
2020-03-30 17:52:16 +00:00
|
|
|
install_store_play
|
2018-04-02 17:44:48 +00:00
|
|
|
;;
|
|
|
|
|
|
|
|
2 )
|
2020-03-30 17:52:16 +00:00
|
|
|
install_store_aurora
|
|
|
|
;;
|
|
|
|
|
|
|
|
3 )
|
|
|
|
install_store_play
|
|
|
|
install_store_aurora
|
2018-11-26 14:15:26 +00:00
|
|
|
;;
|
2018-08-18 16:36:44 +00:00
|
|
|
|
2019-01-14 19:24:18 +00:00
|
|
|
* )
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << without App Store"
|
2019-01-14 19:24:18 +00:00
|
|
|
;;
|
|
|
|
esac
|
2018-08-18 16:36:44 +00:00
|
|
|
|
2019-01-14 19:24:18 +00:00
|
|
|
# Only install Fake Store if requested and Play Store is not installed
|
2018-11-27 18:48:00 +00:00
|
|
|
if [ "${FAKE_STORE}" -eq 1 ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with Fake Store"
|
2018-11-27 18:48:00 +00:00
|
|
|
nanodroid_install_apk FakeStore
|
2019-01-14 19:24:18 +00:00
|
|
|
|
2019-05-23 16:38:19 +00:00
|
|
|
create_privapp_permissions_whitelist FakeStore
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without Fake Store"
|
2018-11-27 18:48:00 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z "${STORE_CONFLICT}" ]; then
|
|
|
|
${NANODROID_BINDIR}/nanodroid-overlay --add ${STORE_CONFLICT}
|
2018-08-20 18:57:22 +00:00
|
|
|
|
|
|
|
if [ "${NANODROID_UPGRADE}" -eq 0 ]; then
|
|
|
|
rm -rf /data/data/com.android.vending
|
|
|
|
rm -rf /data/user/*/com.android.vending
|
|
|
|
rm -rf /data/user_de/*/com.android.vending
|
|
|
|
rm -rf /data/app/com.android.vending-*
|
|
|
|
fi
|
2018-08-18 19:36:34 +00:00
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
install_bash () {
|
2018-03-12 17:40:40 +00:00
|
|
|
if [ "${nanodroid_bash}" -eq 1 ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with GNU Bash Shell"
|
2018-03-12 17:40:40 +00:00
|
|
|
nanodroid_install_file etc/bash_logout
|
|
|
|
nanodroid_install_file etc/bashrc
|
|
|
|
|
2018-03-28 17:51:51 +00:00
|
|
|
nanodroid_install_file xbin/bash bin
|
|
|
|
nanodroid_install_file xbin/bash.bin.${BIN_ARCH} bin
|
|
|
|
nanodroid_install_file xbin/bashbug.${BIN_ARCH} bin
|
|
|
|
nanodroid_install_file xbin/less bin
|
|
|
|
nanodroid_install_file xbin/less.bin.${BIN_ARCH} bin
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without GNU Bash Shell"
|
2018-03-12 17:40:40 +00:00
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2018-03-15 19:55:02 +00:00
|
|
|
install_nanodroidscripts () {
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with NanoDroid Scripts"
|
2018-03-15 19:54:06 +00:00
|
|
|
|
2018-10-02 07:35:03 +00:00
|
|
|
for script in npem nutl novl \
|
|
|
|
nanodroid-perm nanodroid-util \
|
|
|
|
nanodroid-overlay; do
|
2018-03-28 17:51:51 +00:00
|
|
|
nanodroid_install_file xbin/${script} bin
|
2018-03-15 19:54:06 +00:00
|
|
|
done
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2020-02-11 19:29:20 +00:00
|
|
|
nanodroid_install_file xbin/column.${BIN_ARCH} bin
|
2018-04-20 18:12:35 +00:00
|
|
|
nanodroid_substitute xbin/nanodroid-overlay
|
|
|
|
|
2018-03-17 16:24:02 +00:00
|
|
|
if [ "${MODE}" = "MAGISK" ]; then
|
2018-04-20 18:12:35 +00:00
|
|
|
for script in nprp nanodroid-prop; do
|
2018-03-28 17:51:51 +00:00
|
|
|
nanodroid_install_file xbin/${script} bin
|
2018-03-17 16:17:25 +00:00
|
|
|
done
|
|
|
|
|
2018-03-28 18:29:25 +00:00
|
|
|
nanodroid_substitute xbin/nanodroid-prop
|
2018-03-17 16:17:25 +00:00
|
|
|
fi
|
2018-03-17 13:28:47 +00:00
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
install_shell_utils () {
|
2020-02-11 19:29:20 +00:00
|
|
|
if [ -n "${nanodroid_utils}" ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with Shell Utilities"
|
2018-03-12 17:40:40 +00:00
|
|
|
|
2020-02-11 19:29:20 +00:00
|
|
|
for binary in ${nanodroid_utils}; do
|
2018-03-28 17:51:51 +00:00
|
|
|
nanodroid_install_file xbin/${binary}.${BIN_ARCH} bin
|
2018-03-12 17:40:40 +00:00
|
|
|
done
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without Shell Utilities"
|
2018-03-12 17:40:40 +00:00
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
install_initd () {
|
2020-02-11 19:29:20 +00:00
|
|
|
if [ -n "${nanodroid_init}" ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with init scripts"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
if [ "${MODE}" = "SYSTEM" ]; then
|
|
|
|
INIT_BASE="${MODPATH}/system/etc/init.d"
|
|
|
|
else INIT_BASE="${MODPATH}/init.d"
|
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "${INIT_BASE}"
|
|
|
|
cp "${INSTALLER}/system/etc/init.d"/* "${INIT_BASE}/"
|
|
|
|
set_perm_bin "${INIT_BASE}"
|
|
|
|
|
2020-02-11 19:29:20 +00:00
|
|
|
for init in ${nanodroid_init}; do
|
2018-08-23 19:27:15 +00:00
|
|
|
installinfo_add "/system/etc/init.d/${init}"
|
2018-08-21 19:59:15 +00:00
|
|
|
done
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without init scripts"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-11-08 17:27:34 +00:00
|
|
|
install_bromite_webview () {
|
|
|
|
if [ "${MODID}" = "NanoDroid_BromiteWebView" ]; then
|
2019-05-11 19:14:13 +00:00
|
|
|
if ! check_bromite_webview_support; then
|
|
|
|
error "ROM does not support Bromite WebView installation!"
|
|
|
|
else
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with Bromite WebView"
|
2019-05-11 19:14:13 +00:00
|
|
|
|
|
|
|
case ${ARCH} in
|
|
|
|
arm | arm64 | x86 ) BROMITE_ARCH=${ARCH} ;;
|
|
|
|
x86_64 ) BROMITE_ARCH=x86 ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
WEBVIEW_REPLACE=BromiteWebView
|
2019-10-07 20:46:32 +00:00
|
|
|
WEBVIEW_DIR=""
|
2019-05-11 19:14:13 +00:00
|
|
|
BACKUP_PATH="${STORAGE}/nanodroid_backups/$(grep_prop ro.build.flavor)_$(grep_prop ro.build.id)"
|
2018-11-08 17:27:34 +00:00
|
|
|
|
2020-08-16 21:31:20 +00:00
|
|
|
for app in webview webviewstub WebViewStub Webview; do
|
2019-05-11 19:14:13 +00:00
|
|
|
if [ -d /system/app/${app} ]; then
|
|
|
|
if [ "${MODE}" = "SYSTEM" ]; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " backing up ${app} to ${BACKUP_PATH}/app/${app}"
|
2019-05-11 19:14:13 +00:00
|
|
|
mkdir -p "${BACKUP_PATH}/app"
|
|
|
|
rm -rf "${BACKUP_PATH}/app/${app}"
|
|
|
|
mv /system/app/${app} "${BACKUP_PATH}/app/"
|
|
|
|
fi
|
2019-01-06 17:57:15 +00:00
|
|
|
|
2019-05-11 19:14:13 +00:00
|
|
|
WEBVIEW_REPLACE=${app}
|
|
|
|
break
|
2018-11-12 16:54:36 +00:00
|
|
|
fi
|
2019-10-07 20:46:32 +00:00
|
|
|
|
|
|
|
if [ -d /system/product/app/${app} ]; then
|
|
|
|
if [ "${MODE}" = "SYSTEM" ]; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " backing up ${app} to ${BACKUP_PATH}/product/app/${app}"
|
2019-10-07 20:46:32 +00:00
|
|
|
mkdir -p "${BACKUP_PATH}/product/app"
|
|
|
|
rm -rf "${BACKUP_PATH}/product/app/${app}"
|
|
|
|
mv /system/product/app/${app} "${BACKUP_PATH}/product/app/"
|
|
|
|
fi
|
|
|
|
|
|
|
|
WEBVIEW_REPLACE=${app}
|
|
|
|
WEBVIEW_DIR="product/app"
|
|
|
|
break
|
|
|
|
fi
|
2019-05-11 19:14:13 +00:00
|
|
|
done
|
2019-01-06 17:57:15 +00:00
|
|
|
|
2019-05-11 19:14:13 +00:00
|
|
|
if [ "${NANODROID_UPGRADE}" -eq 0 ]; then
|
|
|
|
for app in com.android.webview; do
|
|
|
|
rm -rf /data/data/${app}
|
|
|
|
rm -rf /data/user/*/${app}
|
|
|
|
rm -rf /data/user_de/*/${app}
|
|
|
|
rm -rf /data/app/${app}-*
|
|
|
|
rm -rf /mnt/asec/${app}-*
|
|
|
|
rm -rf ${STORAGE}/Android/data/${app}
|
|
|
|
done
|
2018-11-12 16:54:36 +00:00
|
|
|
fi
|
2018-11-08 17:27:34 +00:00
|
|
|
|
2019-10-07 20:46:32 +00:00
|
|
|
nanodroid_install_apk BromiteWebView_${BROMITE_ARCH} multilib ${WEBVIEW_REPLACE} ${WEBVIEW_DIR}
|
2018-11-12 17:06:21 +00:00
|
|
|
fi
|
2018-11-08 17:27:34 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-11-23 20:04:36 +00:00
|
|
|
install_osmand () {
|
2018-11-23 20:18:01 +00:00
|
|
|
if [ "${MODID}" = "NanoDroid_OsmAnd" ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with OsmAnd"
|
2018-11-23 20:04:36 +00:00
|
|
|
nanodroid_install_apk OsmAnd
|
2018-11-23 20:18:01 +00:00
|
|
|
nanodroid_install_apk OsmAnd_ContourLines
|
2018-11-23 20:04:36 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
install_swipe () {
|
2018-11-26 13:57:01 +00:00
|
|
|
if [ "${nanodroid_swipe}" -eq 1 ]; then
|
2018-10-31 19:35:39 +00:00
|
|
|
if [ "${SWIPE_UNSUPPORTED}" -eq 1 ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << Swipe Libraries are unsupported on SDK ${SDK_VERSION}"
|
2018-10-31 19:35:39 +00:00
|
|
|
else
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << with swipe libraries"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-10-31 19:35:39 +00:00
|
|
|
SWIPE_SRC="${INSTALLER}/swipe/${ARCH}"
|
|
|
|
SWIPE_DEST="/system/${SWIPE_LIBDIR}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2020-08-19 17:27:34 +00:00
|
|
|
APPL_IME="/system/app/LatinIME/${SWIPE_LIBDIR}/${ARCH}"
|
|
|
|
PRODL_IME="/system/product/app/LatinIME/${SWIPE_LIBDIR}/${ARCH}"
|
|
|
|
|
2018-10-31 19:35:39 +00:00
|
|
|
mkdir -p "${MODPATH}${SWIPE_DEST}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-10-31 19:35:39 +00:00
|
|
|
cp "${SWIPE_SRC}/libjni_keyboarddecoder.so" "${MODPATH}${SWIPE_DEST}" || \
|
|
|
|
error "failed to install libjni_keyboarddecoder.so"
|
|
|
|
set_perm_data "${MODPATH}${SWIPE_DEST}/libjni_keyboarddecoder.so"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-10-31 19:35:39 +00:00
|
|
|
cp "${SWIPE_SRC}/${LIBJNI_IME}" "${MODPATH}${SWIPE_DEST}/libjni_latinimegoogle.so" || \
|
|
|
|
error "failed to install libjni_latinimegoogle.so"
|
|
|
|
set_perm_data "${MODPATH}${SWIPE_DEST}/libjni_latinimegoogle.so"
|
|
|
|
|
|
|
|
installinfo_add "${SWIPE_DEST}/libjni_keyboarddecoder.so"
|
|
|
|
installinfo_add "${SWIPE_DEST}/libjni_latinimegoogle.so"
|
2020-08-19 17:27:34 +00:00
|
|
|
|
|
|
|
if [ -f "${APPL_IME}/libjni_latinime.so" ]; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " swipe: symlinking libjni_latinimegoogle as libjni_latinime in ${APPL_IME}"
|
2020-08-19 17:27:34 +00:00
|
|
|
|
|
|
|
mkdir -p "${MODPATH}${APPL_IME}"
|
|
|
|
ln -sfn "${MODPATH}${SWIPE_DEST}/libjni_latinimegoogle.so" "${MODPATH}${APPL_IME}/libjni_latinime.so"
|
|
|
|
ln -sfn "${MODPATH}${SWIPE_DEST}/libjni_keyboarddecoder.so" "${MODPATH}${APPL_IME}/libjni_keyboarddecoder.so"
|
|
|
|
|
|
|
|
installinfo_add "${MODPATH}${APPL_IME}/libjni_latinime.so"
|
|
|
|
installinfo_add "${MODPATH}${APPL_IME}/libjni_keyboarddecoder.so"
|
|
|
|
elif [ -f "${APPL_IME}/libjni_latinimegoogle.so" ]; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " swipe: symlinking libjni_latinimegoogle as libjni_latinimegoogle in ${APPL_IME}"
|
2020-08-19 17:27:34 +00:00
|
|
|
|
|
|
|
mkdir -p "${MODPATH}${APPL_IME}"
|
|
|
|
ln -sfn "${MODPATH}${SWIPE_DEST}/libjni_latinimegoogle.so" "${MODPATH}${APPL_IME}/libjni_latinimegoogle.so"
|
|
|
|
ln -sfn "${MODPATH}${SWIPE_DEST}/libjni_keyboarddecoder.so" "${MODPATH}${APPL_IME}/libjni_keyboarddecoder.so"
|
|
|
|
|
|
|
|
installinfo_add "${MODPATH}${APPL_IME}/libjni_latinimegoogle.so"
|
|
|
|
installinfo_add "${MODPATH}${APPL_IME}/libjni_keyboarddecoder.so"
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -f "${PRODL_IME}/libjni_latinime.so" ]; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " swipe: symlinking libjni_latinimegoogle as libjni_latinime in ${PRODL_IME}"
|
2020-08-19 17:27:34 +00:00
|
|
|
|
|
|
|
mkdir -p "${MODPATH}${PRODL_IME}"
|
|
|
|
ln -sfn "${MODPATH}${SWIPE_DEST}/libjni_latinimegoogle.so" "${MODPATH}${PRODL_IME}/libjni_latinime.so"
|
|
|
|
ln -sfn "${MODPATH}${SWIPE_DEST}/libjni_keyboarddecoder.so" "${MODPATH}${PRODL_IME}/libjni_keyboarddecoder.so"
|
|
|
|
|
|
|
|
installinfo_add "${MODPATH}${PRODL_IME}/libjni_latinime.so"
|
|
|
|
installinfo_add "${MODPATH}${PRODL_IME}/libjni_keyboarddecoder.so"
|
|
|
|
elif [ -f "${PRODL_IME}/libjni_latinimegoogle.so" ]; then
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " swipe: symlinking libjni_latinimegoogle as libjni_latinimegoogle in ${PRODL_IME}"
|
2020-08-19 17:27:34 +00:00
|
|
|
|
|
|
|
mkdir -p "${MODPATH}${PRODL_IME}"
|
|
|
|
ln -sfn "${MODPATH}${SWIPE_DEST}/libjni_latinimegoogle.so" "${MODPATH}${PRODL_IME}/libjni_latinimegoogle.so"
|
|
|
|
ln -sfn "${MODPATH}${SWIPE_DEST}/libjni_keyboarddecoder.so" "${MODPATH}${PRODL_IME}/libjni_keyboarddecoder.so"
|
|
|
|
|
|
|
|
installinfo_add "${MODPATH}${PRODL_IME}/libjni_latinimegoogle.so"
|
|
|
|
installinfo_add "${MODPATH}${PRODL_IME}/libjni_keyboarddecoder.so"
|
|
|
|
fi
|
2018-10-31 19:35:39 +00:00
|
|
|
fi
|
2020-08-20 22:00:11 +00:00
|
|
|
else print_info " << without swipe libraries"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-04-10 17:58:45 +00:00
|
|
|
install_addond () {
|
|
|
|
if [ -d /system/addon.d ]; then
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << System Mode OTA survival"
|
2018-04-10 17:58:45 +00:00
|
|
|
|
|
|
|
cp "${INSTALLER}/CommonAddon" "/system/addon.d/91-nanodroid.sh" || \
|
2018-09-07 16:21:48 +00:00
|
|
|
error "failed to install System Mode OTA survival"
|
2018-04-10 17:58:45 +00:00
|
|
|
|
|
|
|
chmod 0755 "/system/addon.d/91-nanodroid.sh"
|
|
|
|
sed -e "s|@MODID@|${MODID}|g" -i "/system/addon.d/91-nanodroid.sh"
|
|
|
|
else
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " << ROM does not have addon.d support"
|
2018-04-10 17:58:45 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
##########################################################################################
|
|
|
|
# Advanced Installation Functions
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
nanodroid_install_dir () {
|
|
|
|
dir="${1}"
|
2019-10-07 19:33:09 +00:00
|
|
|
[ -n "${2}" ] && dest="${2}" || dest="/system/${dir}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
[ ! -d "${INSTALLER}/system/${dir}" ] && \
|
2018-09-07 16:21:48 +00:00
|
|
|
error "dir: ${dir} not found"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
echo " installing dir: ${dir}"
|
|
|
|
|
|
|
|
mkdir -p "${MODPATH}${dest}"
|
|
|
|
cp -r "${INSTALLER}/system/${dir}"/* "${MODPATH}${dest}/" || \
|
2018-09-07 16:21:48 +00:00
|
|
|
error "failed to install ${dir}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
case ${2} in
|
|
|
|
bin ) set_perm_bin -r "${MODPATH}${dest}" ;;
|
|
|
|
* ) set_perm_data -r "${MODPATH}${dest}" ;;
|
|
|
|
esac
|
|
|
|
|
2018-08-23 19:27:15 +00:00
|
|
|
find "${INSTALLER}/system/${dir}" -type f | \
|
|
|
|
sed -e "s,^${INSTALLER},,g" | \
|
2018-08-24 19:25:01 +00:00
|
|
|
installinfo_add
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nanodroid_install_apk () {
|
|
|
|
app=${1}
|
2018-11-09 20:11:57 +00:00
|
|
|
multilib=${2}
|
|
|
|
alias=${3}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
unset prefix
|
2018-11-06 20:42:52 +00:00
|
|
|
unset source
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2020-01-02 13:24:10 +00:00
|
|
|
for sdir in system/app system/priv-app \
|
2019-08-06 18:12:56 +00:00
|
|
|
gsync/${GSYNC_VER}/app gsync/${GSYNC_VER}/priv-app; do
|
2019-07-08 19:03:25 +00:00
|
|
|
if [ -f "${INSTALLER}/${sdir}/${app}/${app}.apk.gz" ]; then
|
2018-11-06 20:42:52 +00:00
|
|
|
source="${INSTALLER}/${sdir}/${app}/${app}.apk"
|
|
|
|
dir=system/$(basename ${sdir})
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-10-07 20:46:32 +00:00
|
|
|
[ -n "${4}" ] && dir="system/${4}"
|
|
|
|
|
2018-11-06 20:42:52 +00:00
|
|
|
[ -z "${source}" ] && error "app ${app} not found"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
if [ "${UNFOLD_APP_DIR}" -eq 1 ]; then
|
2018-11-09 20:11:57 +00:00
|
|
|
dest="${MODPATH}/${dir}"
|
2018-01-23 20:11:52 +00:00
|
|
|
else
|
2018-11-09 20:11:57 +00:00
|
|
|
if [ -z "${alias}" ]; then
|
|
|
|
dest="${MODPATH}/${dir}/${app}"
|
|
|
|
else dest="${MODPATH}/${dir}/${alias}"
|
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
|
2018-11-09 20:11:57 +00:00
|
|
|
if [ ! -z "${alias}" ]; then
|
|
|
|
dest_apk=${alias}.apk
|
2019-07-08 19:03:25 +00:00
|
|
|
else dest_apk=${app}.apk
|
2018-11-09 20:11:57 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
mkdir -p "${dest}"
|
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " installing app: ${app}"
|
|
|
|
decho " from: ${source}"
|
|
|
|
decho " into: ${dest} [${dest_apk}]"
|
2019-07-08 18:52:43 +00:00
|
|
|
cp "${source}.gz" "${dest}/${dest_apk}.gz" || \
|
2018-09-07 16:21:48 +00:00
|
|
|
error "failed to install ${source} to ${dest}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-07-13 17:53:00 +00:00
|
|
|
gzip -fd "${dest}/${dest_apk}.gz" || \
|
2019-07-08 18:52:43 +00:00
|
|
|
error "failed to decompress ${dest}/${dest_apk}.gz"
|
2019-07-07 19:41:30 +00:00
|
|
|
|
2018-11-09 20:11:57 +00:00
|
|
|
installinfo_add "${dest}/${dest_apk}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-11-09 20:11:57 +00:00
|
|
|
nanodroid_install_lib "${dest}/${dest_apk}" "${2}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-11-09 20:11:57 +00:00
|
|
|
set_perm_data -r "${dest}"
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nanodroid_install_file () {
|
|
|
|
dir="$(dirname "${1}")"
|
|
|
|
file="$(basename "${1}")"
|
2018-11-06 20:48:48 +00:00
|
|
|
unset source
|
|
|
|
|
|
|
|
for sdir in system gsync; do
|
|
|
|
if [ -f "${INSTALLER}/${sdir}/${dir}/${file}" ]; then
|
|
|
|
source="${INSTALLER}/${sdir}/${dir}/${file}"
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-11-06 20:48:48 +00:00
|
|
|
[ -z "${source}" ] && error "file: ${file} not found"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-03-28 17:51:51 +00:00
|
|
|
# if /system/xbin does not exist, use /system/bin
|
2018-05-07 17:39:06 +00:00
|
|
|
[ "${dir}" = "xbin" -a "${ROM_NO_XBIN}" -eq 1 ] && xdir="bin" || xdir="${dir}"
|
2018-03-28 17:51:51 +00:00
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
# strip off .${BIN_ARCH} from final filename (if any)
|
|
|
|
xfile=$(basename ${file} .${BIN_ARCH})
|
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " installing file: ${xfile}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-05-07 17:39:06 +00:00
|
|
|
mkdir -p "${MODPATH}/system/${xdir}/"
|
2018-11-06 20:48:48 +00:00
|
|
|
cp "${source}" "${MODPATH}/system/${xdir}/${xfile}" || \
|
2018-09-07 16:21:48 +00:00
|
|
|
error "failed to install ${xfile}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
case ${2} in
|
2018-05-07 17:39:06 +00:00
|
|
|
bin ) set_perm_bin "${MODPATH}/system/${xdir}/${xfile}" ;;
|
|
|
|
* ) set_perm_data "${MODPATH}/system/${xdir}/${xfile}" ;;
|
2018-01-23 20:11:52 +00:00
|
|
|
esac
|
|
|
|
|
2018-08-23 19:27:15 +00:00
|
|
|
installinfo_add "/system/${xdir}/${xfile}"
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nanodroid_install_lib () {
|
2018-11-09 20:11:57 +00:00
|
|
|
apk="${1}"
|
|
|
|
dest="$(dirname ${1})"
|
|
|
|
multilib="${2}"
|
|
|
|
|
|
|
|
unset libd
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
if [ "${UNFOLD_APP_DIR}" -eq 1 ]; then
|
|
|
|
case ${ARCH} in
|
|
|
|
arm | x86 ) libd=${MODPATH}/system/lib ;;
|
|
|
|
arm64 | x86_64 ) libd=${MODPATH}/system/lib64 ;;
|
|
|
|
esac
|
|
|
|
else
|
2018-11-09 20:11:57 +00:00
|
|
|
libd=${dest}/lib
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
rm -rf ${TMP_LIBDIR}
|
|
|
|
mkdir -p ${TMP_LIBDIR}
|
|
|
|
|
|
|
|
unset srcdir
|
|
|
|
|
2019-05-21 20:29:57 +00:00
|
|
|
"${UNZIP}" -oq "${apk}" "lib/*" -d "${TMP_LIBDIR}" \
|
2018-01-23 20:11:52 +00:00
|
|
|
2>/dev/null
|
|
|
|
unzip_return=$?
|
|
|
|
|
|
|
|
case ${unzip_return} in
|
2020-08-20 21:34:33 +00:00
|
|
|
0 ) decho " ${app} does have libs" ;;
|
|
|
|
11 ) decho " ${app} does not have any libs" ;;
|
2019-04-26 15:10:00 +00:00
|
|
|
50 ) error " not enough space available!" ;;
|
2019-04-26 20:35:51 +00:00
|
|
|
* ) error " unpacking libs for ${app} failed [${unzip_return}]" ;;
|
2018-01-23 20:11:52 +00:00
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -d ${TMP_LIBDIR}/lib ]; then
|
|
|
|
for ARCHLIB in ${LIB_ARCHES}; do
|
|
|
|
if [ -d ${TMP_LIBDIR}/lib/${ARCHLIB} ]; then
|
|
|
|
srcdir=${TMP_LIBDIR}/lib/${ARCHLIB}
|
|
|
|
|
2018-11-08 19:54:10 +00:00
|
|
|
case ${srcdir} in
|
2020-08-20 21:34:33 +00:00
|
|
|
*arm64* ) decho " ${app}: installing arm64 libs"
|
2018-11-08 19:54:10 +00:00
|
|
|
lib_arch=arm64 ;;
|
2020-08-20 21:34:33 +00:00
|
|
|
*arm* ) decho " ${app}: installing arm libs"
|
2018-11-08 19:54:10 +00:00
|
|
|
lib_arch=arm ;;
|
2020-08-20 21:34:33 +00:00
|
|
|
*x86_64* ) decho " ${app}: installing x86_64 libs"
|
2018-11-08 19:54:10 +00:00
|
|
|
lib_arch=x86_64 ;;
|
2020-08-20 21:34:33 +00:00
|
|
|
*x86* ) decho " ${app}: installing x86 libs"
|
2018-11-08 19:54:10 +00:00
|
|
|
lib_arch=x86 ;;
|
|
|
|
esac
|
|
|
|
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " from: ${srcdir}"
|
|
|
|
decho " into: ${libd}/${lib_arch}"
|
2018-11-09 20:11:57 +00:00
|
|
|
mkdir -p "${libd}/${lib_arch}"
|
2018-11-08 19:54:10 +00:00
|
|
|
|
|
|
|
for lib in ${srcdir}/*; do
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " library: $(basename ${lib})"
|
2018-11-09 20:11:57 +00:00
|
|
|
cp ${lib} "${libd}/${lib_arch}/" || \
|
2019-04-26 20:35:51 +00:00
|
|
|
error " installing libs for ${app} failed"
|
2018-11-08 19:54:10 +00:00
|
|
|
|
2019-03-01 13:32:01 +00:00
|
|
|
installinfo_add "${libd}/${lib_arch}/$(basename ${lib})"
|
2018-11-08 19:54:10 +00:00
|
|
|
done
|
2018-11-22 18:50:46 +00:00
|
|
|
|
|
|
|
[ -z "${multilib}" ] && break
|
2018-11-08 19:54:10 +00:00
|
|
|
fi
|
|
|
|
done
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
nanodroid_substitute () {
|
2018-03-28 18:31:11 +00:00
|
|
|
dir="$(dirname "${1}")"
|
|
|
|
file="$(basename "${1}")"
|
|
|
|
|
|
|
|
# if /system/xbin does not exist, use /system/bin
|
|
|
|
[ "${dir}" = "xbin" -a "${ROM_NO_XBIN}" -eq 1 ] && dir="bin"
|
|
|
|
|
|
|
|
target="${MODPATH}/system/${dir}/${file}"
|
|
|
|
|
2018-09-07 16:21:48 +00:00
|
|
|
[ ! -f "${target}" ] && error "file: ${file} not found"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
if grep -q @MODPATH@ ${target}; then
|
2019-05-11 20:24:22 +00:00
|
|
|
sed -e "s|@MODPATH@|${MODPATH}|g" -i ${target}
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " substitute: adjust @MODPATH@ in ${target}"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
2020-08-18 16:13:09 +00:00
|
|
|
|
|
|
|
if grep -q @MODID@ ${target}; then
|
|
|
|
sed -e "s|@MODID@|${MODID}|g" -i ${target}
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " substitute: adjust @MODID@ in ${target}"
|
2020-08-18 16:13:09 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if grep -q @MODE@ ${target}; then
|
|
|
|
sed -e "s|@MODE@|${MODE}|g" -i ${target}
|
2020-08-20 21:34:33 +00:00
|
|
|
decho " substitute: adjust @MODE@ in ${target}"
|
2020-08-18 16:13:09 +00:00
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nanodroid_storelogs () {
|
2019-05-05 10:23:37 +00:00
|
|
|
mkdir -p "${STORAGE}/nanodroid_logs"
|
2018-07-09 18:38:56 +00:00
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
echo "\
|
2018-11-18 21:37:40 +00:00
|
|
|
|
|
|
|
Installation successful: ${INSTALL_SUCCESS}
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
### VALUES ###
|
|
|
|
ZIP=${ZIP}
|
|
|
|
ZIPDIR=${ZIPDIR}
|
|
|
|
TMPDIR=${TMPDIR}
|
|
|
|
TMP_LIBDIR=${TMP_LIBDIR}
|
|
|
|
INSTALLER=${INSTALLER}
|
|
|
|
MODID=${MODID}
|
|
|
|
SDK_VERSION=${SDK_VERSION}
|
|
|
|
ARCH=${ARCH}
|
|
|
|
LIB_ARCHES=${LIB_ARCHES}
|
|
|
|
MODPATH=${MODPATH}
|
|
|
|
SWIPE_LIBDIR=${SWIPE_LIBDIR}
|
|
|
|
MODE=${MODE}
|
|
|
|
MAGISK_VER_CODE=${MAGISK_VER_CODE}
|
2018-03-28 18:14:04 +00:00
|
|
|
ROM_NO_XBIN=${ROM_NO_XBIN}
|
2018-07-08 18:13:12 +00:00
|
|
|
NANODROID_UPGRADE=${NANODROID_UPGRADE}
|
2018-08-19 16:46:55 +00:00
|
|
|
NANODROID_BINDIR=${NANODROID_BINDIR}
|
2019-05-11 19:37:50 +00:00
|
|
|
HAS_FAKESIGN=${HAS_FAKESIGN}
|
|
|
|
HAS_WEBVIEW=${HAS_WEBVIEW}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-01-12 09:04:51 +00:00
|
|
|
### MOUNTED PARTITIONS ###
|
|
|
|
" >> ${nanodroid_logfile}
|
|
|
|
|
|
|
|
mount | awk '{print $1 " on " $3 " params: " $6}' \
|
|
|
|
>> ${nanodroid_logfile}
|
|
|
|
|
2019-04-27 21:23:14 +00:00
|
|
|
echo "
|
2019-07-27 18:40:16 +00:00
|
|
|
### PARTITION INFORMATION ###
|
2019-07-27 18:25:31 +00:00
|
|
|
|
2019-07-27 18:40:16 +00:00
|
|
|
DEVICE_AB=${DEVICE_AB}
|
|
|
|
VENDOR_COMPAT=${VENDOR_COMPAT}
|
2019-07-27 18:25:31 +00:00
|
|
|
SYSTEM_AS_ROOT=${SYSTEM_AS_ROOT}
|
|
|
|
SYSTEMBLOCK=${SYSTEMBLOCK}
|
|
|
|
VENDORBLOCK=${VENDORBLOCK}
|
|
|
|
|
2019-04-27 21:23:14 +00:00
|
|
|
### DISK USAGE ###
|
|
|
|
" >> ${nanodroid_logfile}
|
|
|
|
|
2019-05-12 20:19:52 +00:00
|
|
|
df 2>/dev/null | sed '/^\//d' >> ${nanodroid_logfile}
|
2019-04-27 21:23:14 +00:00
|
|
|
|
2019-07-27 18:27:46 +00:00
|
|
|
if [ ! -z "${cfg_setup}" ]; then
|
|
|
|
|
2019-01-12 09:04:51 +00:00
|
|
|
echo "
|
2018-01-23 20:11:52 +00:00
|
|
|
### SETUP ###
|
2019-07-26 14:23:47 +00:00
|
|
|
|
|
|
|
configuration: ${cfg_setup}
|
2019-04-25 18:57:07 +00:00
|
|
|
" >> ${nanodroid_logfile}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-07-09 18:38:56 +00:00
|
|
|
cat "${cfg_setup}" >> ${nanodroid_logfile}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-07-27 18:27:46 +00:00
|
|
|
fi
|
|
|
|
|
2018-04-10 19:14:52 +00:00
|
|
|
if [ ! -z "${cfg_apps}" ]; then
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
echo "
|
|
|
|
### APPS ###
|
2019-07-26 14:23:47 +00:00
|
|
|
|
|
|
|
configuration: ${cfg_apps}
|
2018-07-09 18:38:56 +00:00
|
|
|
" >> ${nanodroid_logfile}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-07-09 18:38:56 +00:00
|
|
|
cat "${cfg_apps}" >> ${nanodroid_logfile}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-04-10 19:14:52 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -z "${cfg_overlay}" ]; then
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
echo "
|
|
|
|
### OVERLAY ###
|
2019-07-26 14:23:47 +00:00
|
|
|
|
|
|
|
configuration: ${cfg_overlay}
|
2018-07-09 18:38:56 +00:00
|
|
|
" >> ${nanodroid_logfile}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-07-09 18:38:56 +00:00
|
|
|
cat "${cfg_overlay}" >> ${nanodroid_logfile}
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-04-10 19:14:52 +00:00
|
|
|
fi
|
|
|
|
|
2019-05-05 10:23:37 +00:00
|
|
|
chown root:sdcard_rw ${nanodroid_logfile}
|
|
|
|
chmod 0644 ${nanodroid_logfile}
|
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " | storing installation logs in ${STORAGE}/nanodroid_logs/"
|
|
|
|
print_info " | NanoDroid log:"
|
|
|
|
print_info " || ""$(basename ${nanodroid_logfile})"
|
2020-08-18 16:13:09 +00:00
|
|
|
|
|
|
|
if [ -d /twres ]; then
|
|
|
|
nanodroid_twrplog="${STORAGE}/nanodroid_logs/${MODID}_${VERSION}_twrp_${curdate}.log"
|
|
|
|
|
|
|
|
cat /tmp/recovery.log > ${nanodroid_twrplog}
|
|
|
|
|
|
|
|
chown root:sdcard_rw ${nanodroid_twrplog}
|
|
|
|
chmod 0644 ${nanodroid_twrplog}
|
|
|
|
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " | TWRP log:"
|
|
|
|
print_info " || $(basename ${nanodroid_twrplog})"
|
|
|
|
print_info " "
|
2020-08-18 16:13:09 +00:00
|
|
|
fi
|
2018-11-18 21:37:40 +00:00
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
##########################################################################################
|
|
|
|
# NanoDroid Configuration File Handling
|
|
|
|
##########################################################################################
|
|
|
|
|
|
|
|
# check for configuration files
|
2019-07-23 19:13:24 +00:00
|
|
|
config_locations="${STORAGE} /external_sd /sdcard1 ${ZIPDIR} /data"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
|
|
|
get_config () {
|
|
|
|
config=""
|
|
|
|
config_exists=0
|
|
|
|
for path in ${config_locations}; do
|
|
|
|
if test -r "${path}/.nanodroid-${1}"; then
|
|
|
|
config="${path}/.nanodroid-${1}"
|
|
|
|
config_exists=1
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
set_prop () {
|
2018-09-15 17:21:42 +00:00
|
|
|
echo "${1}=${2}" >> "${cfg_setup}"
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# check whether '.nanodroid-setup' has all required entries
|
|
|
|
check_cfg_setup () {
|
2018-09-15 17:21:42 +00:00
|
|
|
source "${cfg_setup}"
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2018-09-15 17:21:42 +00:00
|
|
|
[ -z "${nanodroid_fdroid}" ] && set_prop nanodroid_fdroid 1
|
|
|
|
[ -z "${nanodroid_microg}" ] && set_prop nanodroid_microg 1
|
|
|
|
[ -z "${nanodroid_apps}" ] && set_prop nanodroid_apps 1
|
2018-11-27 18:48:00 +00:00
|
|
|
|
2018-11-27 19:20:47 +00:00
|
|
|
[ -z "${nanodroid_play}" ] && set_prop nanodroid_play 10
|
2018-11-27 18:48:00 +00:00
|
|
|
|
2018-12-08 13:43:50 +00:00
|
|
|
# in NanoDroid 20.3 nanodroid_play has changed
|
2018-11-27 19:20:47 +00:00
|
|
|
if [ "${#nanodroid_play}" -lt 2 ]; then
|
2018-11-27 18:48:00 +00:00
|
|
|
case "${nanodroid_play}" in
|
2018-11-27 19:20:47 +00:00
|
|
|
0 ) tmp_prop="00" ;;
|
|
|
|
1 ) tmp_prop="10" ;;
|
|
|
|
2 ) tmp_prop="20" ;;
|
|
|
|
3 ) tmp_prop="01" ;;
|
|
|
|
4 ) tmp_prop="21" ;;
|
|
|
|
* ) tmp_prop="10" ;;
|
2018-11-27 18:48:00 +00:00
|
|
|
esac
|
|
|
|
|
2018-11-27 18:55:04 +00:00
|
|
|
sed -e '/^nanodroid_play/d' -i "${cfg_setup}"
|
|
|
|
set_prop nanodroid_play "${tmp_prop}"
|
2018-11-27 18:48:00 +00:00
|
|
|
fi
|
2018-01-23 20:11:52 +00:00
|
|
|
|
2019-10-08 18:36:08 +00:00
|
|
|
# in NanoDroid 22.5 nanodroid_play has changed
|
2020-03-30 17:52:16 +00:00
|
|
|
if [ "${nanodroid_play}" -gt 30 ]; then
|
2019-10-08 18:36:08 +00:00
|
|
|
sed -e '/^nanodroid_play/d' -i "${cfg_setup}"
|
2020-03-30 17:52:16 +00:00
|
|
|
set_prop nanodroid_play 20
|
2019-10-08 18:36:08 +00:00
|
|
|
fi
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
if [ "${MODID}" = "NanoDroid" ]; then
|
2018-09-15 17:21:42 +00:00
|
|
|
[ -z "${nanodroid_overlay}" ] && set_prop nanodroid_overlay 1
|
|
|
|
else [ -z "${nanodroid_overlay}" ] && set_prop nanodroid_overlay 0
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
|
2018-09-15 17:21:42 +00:00
|
|
|
[ -z "${nanodroid_mapsv1}" ] && set_prop nanodroid_mapsv1 1
|
|
|
|
[ -z "${nanodroid_gsync}" ] && set_prop nanodroid_gsync 0
|
|
|
|
[ -z "${nanodroid_forcesystem}" ] && set_prop nanodroid_forcesystem 0
|
|
|
|
[ -z "${nanodroid_swipe}" ] && set_prop nanodroid_swipe 0
|
2018-11-27 18:14:35 +00:00
|
|
|
|
2020-03-08 16:13:08 +00:00
|
|
|
[ -z "${nanodroid_bash}" ] && set_prop nanodroid_bash 1
|
|
|
|
|
|
|
|
[ -z "${nanodroid_nlpbackend}" ] && set_prop nanodroid_nlpbackend 1000
|
2018-11-27 18:14:35 +00:00
|
|
|
|
2018-12-08 13:43:50 +00:00
|
|
|
# in NanoDroid 20.3 nanodroid_nlpbackend has changed
|
2018-11-27 19:20:47 +00:00
|
|
|
if [ "${#nanodroid_nlpbackend}" -eq 1 ]; then
|
2018-11-27 18:14:35 +00:00
|
|
|
case "${nanodroid_nlpbackend}" in
|
2020-03-08 16:13:08 +00:00
|
|
|
0 ) tmp_prop="0000" ;;
|
|
|
|
1 ) tmp_prop="1000" ;;
|
|
|
|
2 ) tmp_prop="0100" ;;
|
|
|
|
3 ) tmp_prop="1100" ;;
|
|
|
|
* ) tmp_prop="1000" ;;
|
2018-11-27 18:14:35 +00:00
|
|
|
esac
|
|
|
|
|
2019-01-05 23:04:36 +00:00
|
|
|
sed -e '/^nanodroid_nlpbackend/d' -i "${cfg_setup}"
|
|
|
|
set_prop nanodroid_nlpbackend "${tmp_prop}"
|
2020-03-08 19:55:11 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# in NanoDroid 20.5 nanodroid_nlpbackend has changed (again)
|
|
|
|
if [ "${#nanodroid_nlpbackend}" -eq 3 ]; then
|
2019-01-05 23:04:36 +00:00
|
|
|
tmp_prop="${nanodroid_nlpbackend}0"
|
2018-11-27 18:14:35 +00:00
|
|
|
sed -e '/^nanodroid_nlpbackend/d' -i "${cfg_setup}"
|
|
|
|
set_prop nanodroid_nlpbackend "${tmp_prop}"
|
|
|
|
fi
|
|
|
|
|
2020-04-17 15:54:45 +00:00
|
|
|
nanodroid_all_init='"10_sqlite 20_fstrim 30_logcat 40_external_sd 50_logscleaner"'
|
|
|
|
|
|
|
|
[ -z "${nanodroid_init}" ] && set_prop nanodroid_init "${nanodroid_all_init}"
|
2020-03-08 16:13:08 +00:00
|
|
|
|
2020-03-08 19:55:11 +00:00
|
|
|
# in NanoDroid 22.7 nanodroid_init has changed
|
2020-03-08 16:13:08 +00:00
|
|
|
if [ "${#nanodroid_init}" -eq 1 ]; then
|
|
|
|
sed -e '/^nanodroid_init/d' -i "${cfg_setup}"
|
2020-04-17 15:54:45 +00:00
|
|
|
set_prop nanodroid_init "${nanodroid_all_init}"
|
2020-03-08 16:13:08 +00:00
|
|
|
fi
|
|
|
|
|
2020-04-17 15:54:45 +00:00
|
|
|
nanodroid_all_utils='"findfs findmnt hexdump lessecho lesskey lsblk lscpu lsipc lslocks lsns ncal whereis"'
|
|
|
|
|
|
|
|
[ -z "${nanodroid_utils}" ] && set_prop nanodroid_utils "${nanodroid_all_utils}"
|
2020-03-08 16:13:08 +00:00
|
|
|
|
2020-03-08 19:55:11 +00:00
|
|
|
# in NanoDroid 22.7 nanodroid_util has changed
|
2020-03-08 16:13:08 +00:00
|
|
|
if [ "${#nanodroid_utils}" -eq 1 ]; then
|
|
|
|
sed -e '/^nanodroid_utils/d' -i "${cfg_setup}"
|
2020-04-17 15:54:45 +00:00
|
|
|
set_prop nanodroid_utils "${nanodroid_all_utils}"
|
2020-03-08 16:13:08 +00:00
|
|
|
fi
|
2019-06-08 20:39:22 +00:00
|
|
|
|
|
|
|
# in NanoDroid 21.0.90 nanodroid_override was dropped
|
2020-04-17 15:54:45 +00:00
|
|
|
sed -e '/^nanodroid_override/d' -i "${cfg_setup}"
|
2019-10-07 19:33:09 +00:00
|
|
|
|
|
|
|
# in NanoDroid 22.5 nanodroid_fonts was dropped
|
2020-04-17 15:54:45 +00:00
|
|
|
sed -e '/^nanodroid_fonts/d' -i "${cfg_setup}"
|
2018-09-15 17:21:42 +00:00
|
|
|
|
2020-01-17 21:13:12 +00:00
|
|
|
# in NanoDroid 22.6 nanodroid_nano was dropped
|
2020-04-17 15:54:45 +00:00
|
|
|
sed -e '/^nanodroid_nano/d' -i "${cfg_setup}"
|
2020-01-17 21:03:40 +00:00
|
|
|
|
2020-01-17 21:13:12 +00:00
|
|
|
# in NanoDroid 22.6 nanodroid_zelda was dropped
|
2020-04-17 15:54:45 +00:00
|
|
|
sed -e '/^nanodroid_zelda/d' -i "${cfg_setup}"
|
2020-01-17 21:09:36 +00:00
|
|
|
|
2018-09-15 17:21:42 +00:00
|
|
|
source "${cfg_setup}"
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2018-09-15 17:21:42 +00:00
|
|
|
# check whether '.nanodroid-apps' is up to date
|
2018-01-23 20:11:52 +00:00
|
|
|
check_cfg_apps () {
|
2018-04-22 17:36:59 +00:00
|
|
|
# <= 16.3 has KeePass DX instead of KeePassDroid, migrate
|
2019-06-09 18:31:15 +00:00
|
|
|
grep -q KeePassDroid "${cfg_apps}" && sed -e 's/KeePassDroid/KeePassDX/g' -i "${cfg_apps}"
|
2018-04-22 17:36:59 +00:00
|
|
|
|
2019-07-26 14:29:24 +00:00
|
|
|
# <= 17.7 has Substratum instead of Bucket (LibreSubtratum), migrate
|
2019-06-09 18:31:15 +00:00
|
|
|
grep -q Bucket "${cfg_apps}" && sed -e 's/Bucket/Substratum/g' -i "${cfg_apps}"
|
2018-09-15 17:21:42 +00:00
|
|
|
|
|
|
|
# <= 18.1 has Orfox instead of TorBrowser, migrate
|
2019-06-09 18:31:15 +00:00
|
|
|
grep -q Orfox "${cfg_apps}" && sed -e 's/Orfox/TorBrowser/g' -i "${cfg_apps}"
|
2018-09-29 20:05:51 +00:00
|
|
|
|
|
|
|
# <= 18.4 has Adaway instead of Blockada, migrate
|
2019-06-09 18:31:15 +00:00
|
|
|
grep -q Adaway "${cfg_apps}" && sed -e 's/Adaway/Blokada/g' -i "${cfg_apps}"
|
2019-04-24 18:55:29 +00:00
|
|
|
|
|
|
|
# >= 20.7.92 no longer ships YahooWeatherProvider, remove
|
2019-06-09 18:31:15 +00:00
|
|
|
grep -q YahooWeatherProvider "${cfg_apps}" && sed -e '/YahooWeatherProvider/d' -i "${cfg_apps}"
|
2019-05-11 18:41:36 +00:00
|
|
|
|
|
|
|
# >= 20.8.90 no longer ships OmniJAWS, remove
|
2019-06-09 18:31:15 +00:00
|
|
|
grep -q OmniJAWS "${cfg_apps}" && sed -e '/OmniJAWS/d' -i "${cfg_apps}"
|
2019-06-08 20:37:54 +00:00
|
|
|
|
|
|
|
# >= 21.0.90 has Alarmio instead of OmniClock, migrate
|
2019-06-09 18:31:15 +00:00
|
|
|
grep -q OmniClock "${cfg_apps}" && sed -e 's/OmniClock/Alarmio/g' -i "${cfg_apps}"
|
2019-06-08 20:46:47 +00:00
|
|
|
|
|
|
|
# >= 21.0.90 no longer ships OpenWeatherMapProvider, remove
|
2019-06-09 18:31:15 +00:00
|
|
|
grep -q OpenWeatherMapProvider "${cfg_apps}" && sed -e '/OpenWeatherMapProvider/d' -i "${cfg_apps}"
|
2019-06-09 18:29:16 +00:00
|
|
|
|
|
|
|
# >= 21.0.90 has Lightning instead of Privacy Browser, migrate
|
|
|
|
grep -q Lightning "${cfg_apps}" && sed -e 's/Lightning/PrivacyBrowser/g' -i "${cfg_apps}"
|
2019-06-09 18:41:17 +00:00
|
|
|
|
|
|
|
# >= 21.0.90 has Hacker's Keyboard instead of BeHeKeyboard, migrate
|
|
|
|
grep -q BeHeKeyboard "${cfg_apps}" && sed -e 's/BeHeKeyboard/HackersKeyboard/g' -i "${cfg_apps}"
|
2019-07-26 19:28:40 +00:00
|
|
|
|
|
|
|
# >= 22.1 has SmartPack-Kernel-Manager instead of Kernel Adiutor, migrate
|
|
|
|
grep -q KernelAdiutor "${cfg_apps}" && sed -e 's/KernelAdiutor/SmartPackKernelManager/g' -i "${cfg_apps}"
|
2020-01-17 20:56:26 +00:00
|
|
|
|
2020-01-17 21:13:12 +00:00
|
|
|
# >= 22.6 has Frost instead of FaceSlim, migrate
|
2020-01-17 20:56:26 +00:00
|
|
|
grep -q FaceSlim "${cfg_apps}" && sed -e 's/FaceSlim/Frost/g' -i "${cfg_apps}"
|
2020-01-17 20:58:10 +00:00
|
|
|
|
2020-01-17 21:13:12 +00:00
|
|
|
# >= 22.6 no longer ships Substratum, remove
|
2020-01-17 20:58:10 +00:00
|
|
|
grep -q Substratum "${cfg_apps}" && sed -e '/Substratum/d' -i "${cfg_apps}"
|
2020-01-17 20:59:59 +00:00
|
|
|
|
2020-01-17 21:13:12 +00:00
|
|
|
# >= 22.6 no longer ship Orbot, remove
|
2020-01-17 20:59:59 +00:00
|
|
|
grep -q Orbot "${cfg_apps}" && sed -e '/Orbot/d' -i "${cfg_apps}"
|
|
|
|
|
2020-07-27 18:07:06 +00:00
|
|
|
# >= 22.7 has OAndBackupX instead of Oandbackup
|
|
|
|
grep -q Oandbackup "${cfg_apps}" && sed -e 's/Oandbackup/OAndBackupX/g' -i "${cfg_apps}"
|
|
|
|
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
2018-09-15 17:21:42 +00:00
|
|
|
# check whether '.nanodroid-overlay' is up to date
|
2018-01-23 20:11:52 +00:00
|
|
|
check_cfg_overlay () {
|
2019-07-26 14:27:26 +00:00
|
|
|
# 22.0 flagged the following for overlay creation which caused issues
|
|
|
|
grep -q "^GmsCore$" "${cfg_overlay}" && sed '/^GmsCore$/d' -i "${cfg_overlay}"
|
|
|
|
grep -q "^GsfProxy$" "${cfg_overlay}" && sed '/^GsfProxy$/d' -i "${cfg_overlay}"
|
|
|
|
grep -q "^DroidGuard$" "${cfg_overlay}" && sed '/^DroidGuard$/d' -i "${cfg_overlay}"
|
2018-01-23 20:11:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
get_cfg_setup () {
|
|
|
|
get_config setup
|
|
|
|
if [ "$config_exists" -eq 1 ]; then
|
|
|
|
cfg_setup="${config}"
|
|
|
|
check_cfg_setup
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Config | nanodroid-setup | $(dirname ${cfg_setup})"
|
2018-01-23 20:11:52 +00:00
|
|
|
else
|
|
|
|
cfg_setup="${INSTALLER}/.nanodroid-setup"
|
|
|
|
source "${cfg_setup}"
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Config | nanodroid-setup | fallback"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
get_cfg_overlay () {
|
|
|
|
get_config overlay
|
|
|
|
if [ "$config_exists" -eq 1 ]; then
|
|
|
|
cfg_overlay="${config}"
|
|
|
|
check_cfg_overlay
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Config | nanodroid-overlay | $(dirname ${cfg_overlay})"
|
2018-01-23 20:11:52 +00:00
|
|
|
else
|
|
|
|
cfg_overlay="${INSTALLER}/.nanodroid-overlay"
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Config | nanodroid-overlay | fallback"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
get_cfg_apps () {
|
|
|
|
get_config apps
|
|
|
|
if [ "$config_exists" -eq 1 ]; then
|
|
|
|
cfg_apps="${config}"
|
|
|
|
check_cfg_apps
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Config | nanodroid-apps | $(dirname ${cfg_apps})"
|
2018-01-23 20:11:52 +00:00
|
|
|
else
|
|
|
|
cfg_apps="${INSTALLER}/.nanodroid-apps"
|
2020-08-20 22:00:11 +00:00
|
|
|
print_info " > Config | nanodroid-apps | fallback"
|
2018-01-23 20:11:52 +00:00
|
|
|
fi
|
|
|
|
}
|