diff --git a/Full/system/etc/bashrc b/Full/system/etc/bashrc index c753b6a..81c8862 100644 --- a/Full/system/etc/bashrc +++ b/Full/system/etc/bashrc @@ -2,12 +2,17 @@ export SHELL=${BASH} -if [ -w /data/media/0 ]; then - export HOME="/data/media/0" -elif [ -w /storage/self/primary ]; then - export HOME="/storage/self/primary" +# select storage path +if [ -n ${EXTERNAL_STORAGE} ]; then + export HOME="${EXTERNAL_STORAGE}/logcats" 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 export TMPDIR=${HOME}/.bash_tmp diff --git a/Full/system/etc/init.d/logcat b/Full/system/etc/init.d/logcat index e5f25d8..bfeac87 100755 --- a/Full/system/etc/init.d/logcat +++ b/Full/system/etc/init.d/logcat @@ -1,17 +1,19 @@ #!/system/bin/sh -# Set current date in 20170607-12.07.25 format -CURDATE=$(date +%Y%m%d-%I.%M.%S) - # wait until boot completed until [ `getprop sys.boot_completed`. = 1. ]; do sleep 1; done -if [ -w /data/media/0 ]; then - LOGDIR="/data/media/0/logcats" -elif [ -w /storage/self/primary ]; then - LOGDIR="/storage/self/primary/logcats" +# select storage path +if [ -n ${EXTERNAL_STORAGE} ]; then + LOGDIR="${EXTERNAL_STORAGE}/logcats" else - LOGDIR="/sdcard/logcats" + if [ -w /sdcard ]; then + LOGDIR="/sdcard/logcats" + elif [ -w /storage/self/primary ]; then + LOGDIR="/storage/self/primary/logcats" + elif [ -w /data/media/0 ]; then + LOGDIR="/data/media/0/logcats" + fi fi 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 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}" logcat -f "${LOGDIR}/${CURDATE}" & diff --git a/Full/system/xbin/nanodroid-overlay b/Full/system/xbin/nanodroid-overlay index d9fa32e..b318288 100755 --- a/Full/system/xbin/nanodroid-overlay +++ b/Full/system/xbin/nanodroid-overlay @@ -21,12 +21,17 @@ else error "couldn't find NanoDroid!" fi -if [ -w /data/media/0 ]; then - STORAGE="/data/media/0" -elif [ -w /storage/self/primary ]; then - STORAGE="/storage/self/primary" +# select storage path +if [ -n ${EXTERNAL_STORAGE} ]; then + STORAGE="${EXTERNAL_STORAGE}/logcats" 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 grep_prop() {