This repository has been archived by the owner on Dec 25, 2022. It is now read-only.
forked from Androidacy/WebviewManager-Module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
post-fs-data.sh
45 lines (45 loc) · 1.61 KB
/
post-fs-data.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/data/adb/magisk/busybox ash
# shellcheck shell=dash
# shellcheck disable=SC2034
ASH_STANDALONE=1
SH=$(readlink -f "$0")
MODDIR=$(dirname "$SH")
OVERLAY=false
# shellcheck disable=SC1090,SC1091
. "${MODDIR}"/status.txt
FINDLOG="$MODDIR"/logs/find.log
PROPSLOG="$MODDIR"/logs/postfsdata.log
touch "$FINDLOG"
OL="org.androidacy.WebviewOverlay"
LIST="/data/system/overlays.xml"
DR="$(cat "$MODDIR"/overlay.txt)"
API="$(getprop ro.build.version.sdk)"
touch "$PROPSLOG"
echo "Firing up logging NOW "
BRAND=$(getprop ro.product.brand)
MODEL=$(getprop ro.product.model)
DEVICE=$(getprop ro.product.device)
ROM=$(getprop ro.build.display.id)
API=$(grep_prop ro.build.version.sdk)
{
echo "Module: Webview Manager Lite"
echo "Device: $BRAND $MODEL ($DEVICE)"
echo "ROM: $ROM, sdk$API"
} >"$PROPSLOG"
set -x >>"$PROPSLOG"
if test "$API" -lt "27"; then
STATE="3"
else
STATE="6"
fi
if ! $OVERLAY; then
echo "Clearing caches..."
rm -rf /data/resource-cache/* /data/dalvik-cache/* /cache/dalvik-cache/* /data/*/com*android.webview* /data/*/*/com*android.webview* /data/system/package_cache/*
sed -i "/com*webview/d" /data/system/packages.list
sed -i "/com*webview/d" /data/system/packages.xml
echo "Forcing the system to register our overlay..."
sed -i "/item packageName=\"${OL}\"/d" /data/system/overlays.xml
sed -i "s|</overlays>| <item packageName=\"${OL}\" userId=\"0\" targetPackageName=\"android\" baseCodePath=\"${DR}/WebviewOverlay.apk\" state=\"${STATE}\" isEnabled=\"true\" isStatic=\"true\" priority=\"9999\" /></overlays>|" $LIST
sed -i "/OVERLAY/d" "${MODDIR}"/status.txt
echo "OVERLAY=true" >>"${MODDIR}"/status.txt
fi