Last active
April 22, 2019 20:08
-
-
Save jtopian/4125c85e799ba65b806c99bacbd07069 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/system/bin/sh | |
# | |
# ADDOND_VERSION=2 | |
# | |
# /system/addon.d/54-CustomUISounds.sh | |
# | |
# Shamelessly modified from the addon.d script provided by OpenGApps. | |
# This script preserves any listed custom UI audio files through a LineageOS OTA. | |
. /postinstall/tmp/backuptool.functions | |
if [ -z $backuptool_ab ]; then | |
SYS=$S | |
TMP=/tmp | |
else | |
SYS=/postinstall/system | |
TMP=/postinstall/tmp | |
fi | |
list_files() { | |
cat <<EOF | |
media/audio/ui/Lock.ogg | |
media/audio/ui/Unlock.ogg | |
media/audio/ui/LowBattery.ogg | |
EOF | |
} | |
case "$1" in | |
backup) | |
list_files | while read -r FILE DUMMY; do | |
backup_file "$S"/"$FILE" | |
done | |
;; | |
restore) | |
list_files | while read -r FILE REPLACEMENT; do | |
R="" | |
[ -n "$REPLACEMENT" ] && R="$S/$REPLACEMENT" | |
[ -f "$C/$S/$FILE" ] && restore_file "$S"/"$FILE" "$R" | |
done | |
;; | |
pre-backup) | |
# Stub | |
;; | |
post-backup) | |
# Stub | |
;; | |
pre-restore) | |
# Move the stock files out of the way | |
# This part is untested, will update later. Should work... | |
list_files | while read -r FILE DUMMY; do | |
mv "$SYS"/"$FILE" "$SYS"/"FILE".bak | |
done | |
# Previously... | |
#mv $SYS/media/audio/ui/Logg.ogg $SYS/media/audio/ui/Logg.ogg.bak | |
#mv $SYS/media/audio/ui/Unlock.ogg $SYS/media/audio/ui/Unlock.ogg.bak | |
#mv $SYS/media/audio/ui/LowBattery.ogg $SYS/media/audio/ui/LowBattery.ogg.bak | |
;; | |
post-restore) | |
# Stub | |
;; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment