2
0
mirror of https://gitlab.com/Nanolx/NanoDroid synced 2024-11-07 15:20:36 +00:00
This commit is contained in:
Christopher Roy Bratusek 2019-05-05 21:19:34 +02:00
parent 61acf33bd3
commit a47373453b
3 changed files with 34 additions and 18 deletions

View File

@ -2,12 +2,17 @@
export SHELL=${BASH} export SHELL=${BASH}
if [ -w /data/media/0 ]; then # select storage path
export HOME="/data/media/0" if [ -n ${EXTERNAL_STORAGE} ]; then
elif [ -w /storage/self/primary ]; then export HOME="${EXTERNAL_STORAGE}/logcats"
export HOME="/storage/self/primary"
else else
export HOME="/sdcard" if [ -w /sdcard ]; then
export HOME="/sdcard/logcats"
elif [ -w /storage/self/primary ]; then
export HOME="/storage/self/primary/logcats"
elif [ -w /data/media/0 ]; then
export HOME="/data/media/0/logcats"
fi
fi fi
export TMPDIR=${HOME}/.bash_tmp export TMPDIR=${HOME}/.bash_tmp

View File

@ -1,17 +1,19 @@
#!/system/bin/sh #!/system/bin/sh
# Set current date in 20170607-12.07.25 format
CURDATE=$(date +%Y%m%d-%I.%M.%S)
# wait until boot completed # wait until boot completed
until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done
if [ -w /data/media/0 ]; then # select storage path
LOGDIR="/data/media/0/logcats" if [ -n ${EXTERNAL_STORAGE} ]; then
LOGDIR="${EXTERNAL_STORAGE}/logcats"
else
if [ -w /sdcard ]; then
LOGDIR="/sdcard/logcats"
elif [ -w /storage/self/primary ]; then elif [ -w /storage/self/primary ]; then
LOGDIR="/storage/self/primary/logcats" LOGDIR="/storage/self/primary/logcats"
else elif [ -w /data/media/0 ]; then
LOGDIR="/sdcard/logcats" LOGDIR="/data/media/0/logcats"
fi
fi fi
echo "logcat init script" echo "logcat init script"
@ -23,6 +25,10 @@ echo "Starting Automatic Cleaning at $(date +"%m-%d-%Y %H:%M:%S")"
find /data/adb/logcat/ -print -mtime +8 -exec rm -f {} \; 2>/dev/null find /data/adb/logcat/ -print -mtime +8 -exec rm -f {} \; 2>/dev/null
echo "Automatic Cleaning finished at $(date +"%m-%d-%Y %H:%M:%S")" echo "Automatic Cleaning finished at $(date +"%m-%d-%Y %H:%M:%S")"
# Set current date in 20170607-12.07.25 format
CURDATE=$(date +%Y%m%d-%I.%M.%S)
echo "Recording logcat to: ${LOGDIR}/${CURDATE}" echo "Recording logcat to: ${LOGDIR}/${CURDATE}"
logcat -f "${LOGDIR}/${CURDATE}" & logcat -f "${LOGDIR}/${CURDATE}" &

View File

@ -21,12 +21,17 @@ else
error "couldn't find NanoDroid!" error "couldn't find NanoDroid!"
fi fi
if [ -w /data/media/0 ]; then # select storage path
STORAGE="/data/media/0" if [ -n ${EXTERNAL_STORAGE} ]; then
elif [ -w /storage/self/primary ]; then STORAGE="${EXTERNAL_STORAGE}/logcats"
STORAGE="/storage/self/primary"
else else
STORAGE="/sdcard" if [ -w /sdcard ]; then
STORAGE="/sdcard/logcats"
elif [ -w /storage/self/primary ]; then
STORAGE="/storage/self/primary/logcats"
elif [ -w /data/media/0 ]; then
STORAGE="/data/media/0/logcats"
fi
fi fi
grep_prop() { grep_prop() {