Skip to content

Instantly share code, notes, and snippets.

@Surge1223
Created June 27, 2017 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Surge1223/8e0cbb1829d476b1a6f6afd97cbdb8b4 to your computer and use it in GitHub Desktop.
Save Surge1223/8e0cbb1829d476b1a6f6afd97cbdb8b4 to your computer and use it in GitHub Desktop.
Subs rescue
#!/sbin/sh
PATH=/sbin:/system/bin:/system/xbin
export subs1=/sdcard/substratum
export subs2=/sdcard/.substratum
export datatheme=/data/system/theme
OUTFD=$2
ZIP=$3
ui_print() {
echo -n -e "ui_print $1\n" > /proc/self/fd/$OUTFD
echo -n -e "ui_print\n" > /proc/self/fd/$OUTFD
}
ui_print "===================================================="
ui_print " Substratum Overlay Manager Service Rescue System"
ui_print "===================================================="
mount /system
mount -o rw,remount /system
mount -o rw,remount /system /system
ui_print "- Checking files"
if [ -f "/data/system/overlays.xml" ]; then
rm /data/system/overlays.xml
touch /data/system/overlays.xml
fi
ui_print "- Checking subs dirs"
if [ -d "$subs1" ]; then
ui_print "- deleting subs storage dir"
echo "- deleting subs storage dir"
rm -rf $subs1
fi
if [ -d "$subs2" ]; then
ui_print "- deleting subs overlay dir"
echo "- deleting subs overlay dir"
rm -rf $subs2
fi
ui_print "- Checking directories"
if [ -d "$datatheme" ]; then
ui_print "- fixing theme dir perms"
rm -rf $datatheme/+
chown 1000.1000 $datatheme
chmod 0755 -R $datatheme
else
mkdir $datatheme
ui_print "- making theme dir with perms"
chown 1000.1000 $datatheme
chmod 0755 -R $datatheme
fi
ui_print "- Unmounting mounts"
umount /system
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment