Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --remove param to remove files #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions push.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

list_files="addon.d/60-ih8sn.sh bin/ih8sn etc/ih8sn.conf etc/init/ih8sn.rc"

while getopts ":-:" o; do
case "${OPTARG}" in
reboot)
Expand All @@ -8,6 +10,9 @@ while getopts ":-:" o; do
use_remount)
USE_REMOUNT=1
;;
remove)
REMOVE=1
;;
esac
done

Expand All @@ -21,6 +26,24 @@ elif [[ "$(adb shell stat -f --format %a /system)" = "0" ]]; then
else
adb wait-for-device shell "stat --format %m /system | xargs mount -o rw,remount"
fi

# Remove files if param 'remove' is provided
if [[ "${REMOVE}" = "1" ]]; then
echo "Checking for ih8sn files to remove ..."
count_removed=0
for FILE in $list_files
do
# If the file exist, remove it
if [[ ! -z $( adb wait-for-device shell ls /system/$FILE 2>/dev/null ) ]]; then
echo "Deleting the file /system/$FILE"
adb wait-for-device shell rm /system/$FILE
count_removed=$(( count_removed + 1 ))
fi
done
echo "Found $count_removed ih8sn files to remove."
exit 0
fi

adb wait-for-device push 60-ih8sn.sh /system/addon.d/
adb wait-for-device push ih8sn /system/bin/
adb wait-for-device push ih8sn.rc /system/etc/init/
Expand Down