2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-11-07 15:20:36 +00:00

Merge branch 'master' into 'master'

init.d scripts improvements

See merge request Nanolx/NanoDroid!20
This commit is contained in:
Christopher Roy Bratusek 2019-05-08 17:09:16 +00:00
commit 4fa7e171ef
7 changed files with 66 additions and 54 deletions

View File

@ -0,0 +1,37 @@
#!/system/bin/sh
# be sure init.rc post-fs-data completed
until [ `getprop vold.post_fs_data_done`. = 1. ]; do sleep 1; done
# run script only when battery charged enough
capacity=$(cat /sys/class/power_supply/battery/capacity)
if [ "$capacity" -gt "15" ]; then
echo "sqlite init script"
if which sqlite3 >/dev/null; then
echo "SQLite database VACUUM and REINDEX started at $(date +%Y%m%d-%H.%M.%S)"
for i in `find /data/* -iname "*.db"`; do
sqlite3 $i 'VACUUM;'
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS"
else
resVac="ERRCODE-$resVac"
fi;
sqlite3 $i 'REINDEX;'
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS"
else
resIndex="ERRCODE-$resIndex"
fi
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex"
done
echo "SQLite database VACUUM and REINDEX finished at $(date +%Y%m%d-%H.%M.%S)"
else
echo "sqlite3 not installed, stop"
fi
fi

View File

@ -0,0 +1,23 @@
#!/system/bin/sh
# be sure init.rc post-fs-data completed
until [ `getprop vold.post_fs_data_done`. = 1. ]; do sleep 1; done
# run script only when battery charged enough
capacity=$(cat /sys/class/power_supply/battery/capacity)
if [ "$capacity" -gt "15" ]; then
echo "fstrim init script"
if [ -e /init.fstrim.sh ]; then
echo "/init.fstrim.sh exists, trimming /preload only"
fstrim -v /preload
else
echo "/init.fstrim.sh does not exist, trimming /cache, /system, /vendor, /data, /preload"
fstrim -v /cache
fstrim -v /system
fstrim -v /vendor
fstrim -v /data
fstrim -v /preload
fi
fi

View File

@ -1,7 +1,7 @@
#!/system/bin/sh #!/system/bin/sh
# wait until boot completed # be sure init.rc post-fs-data completed
until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done until [ `getprop vold.post_fs_data_done`. = 1. ]; do sleep 1; done
LOGDIR="/data/adb/logcats" LOGDIR="/data/adb/logcats"

View File

@ -2,8 +2,8 @@
echo "external_sd init script" echo "external_sd init script"
# wait until boot completed # be sure init.rc post-fs-data completed
until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done until [ `getprop vold.post_fs_data_done`. = 1. ]; do sleep 1; done
if getprop ro.build.characteristics | grep -q nosdcard; then if getprop ro.build.characteristics | grep -q nosdcard; then
echo ">> no SD Card Slot" echo ">> no SD Card Slot"

View File

@ -1,7 +1,7 @@
#!/system/bin/sh #!/system/bin/sh
# wait until boot completed # be sure init.rc post-fs-data completed
until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done until [ `getprop vold.post_fs_data_done`. = 1. ]; do sleep 1; done
echo "logscleaner init script" echo "logscleaner init script"
echo "Starting Automatic Cleaning at $(date +%Y%m%d-%H.%M.%S)" echo "Starting Automatic Cleaning at $(date +%Y%m%d-%H.%M.%S)"

View File

@ -1,17 +0,0 @@
#!/system/bin/sh
# wait until boot completed
until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done
echo "fstrim init script"
if [ -e /init.fstrim.sh ]; then
echo "/init.fstrim.sh exists, trimming /preload only"
fstrim -v /preload
else
echo "/init.fstrim.sh does not exist, trimming /cache, /system, /data, /preload"
fstrim -v /cache
fstrim -v /system
fstrim -v /data
fstrim -v /preload
fi

View File

@ -1,31 +0,0 @@
#!/system/bin/sh
# wait until boot completed
until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done
echo "sqlite init script"
if which sqlite3 >/dev/null; then
echo "SQLite database VACUUM and REINDEX started at $(date +%Y%m%d-%H.%M.%S)"
for i in `find /data/* -iname "*.db"`; do
sqlite3 $i 'VACUUM;'
resVac=$?
if [ $resVac == 0 ]; then
resVac="SUCCESS"
else
resVac="ERRCODE-$resVac"
fi;
sqlite3 $i 'REINDEX;'
resIndex=$?
if [ $resIndex == 0 ]; then
resIndex="SUCCESS"
else
resIndex="ERRCODE-$resIndex"
fi
echo "Database $i: VACUUM=$resVac REINDEX=$resIndex"
done
echo "SQLite database VACUUM and REINDEX finished at $(date +%Y%m%d-%H.%M.%S)"
else echo "sqlite3 not installed, stop"
fi