Skip to content
This repository was archived by the owner on Jan 5, 2022. It is now read-only.

Commit 9d1800b

Browse files
committed
smoother output on Xprivacy export
- keeping file size updates on the same line (overwrite) - only has effect in log level 4+
1 parent 116d284 commit 9d1800b

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

adebar-cli

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,17 +232,22 @@ declare -a dApps
232232

233233
#########################################[ Helpers ]###
234234
# Log progress (if enabled)
235-
# Call: doProgress "what to show" [level]"
236-
# level defaults to 1
235+
# Call: doProgress "what to show" [level [eparm]]"
236+
# level defaults to 1; eparm has optional additional params to echo
237237
doProgress() {
238238
[[ $PROGRESS -eq 0 ]] && return
239239
if [[ -z "$2" ]]; then
240240
local level=1
241241
else
242242
local level=$2
243243
fi
244+
if [[ -n "$3" ]]; then
245+
local eparm="-e${3}"
246+
else
247+
local eparm="-e"
248+
fi
244249
if [[ $PROGRESS -ge $level ]]; then
245-
echo -e "$1"
250+
echo ${eparm} "$1"
246251
fi
247252
}
248253

lib/pull_config.lib

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ getXPrivacy() {
8888
local -i sleepcount=0
8989
local -i oldsize=0
9090
local -i newsize=0
91-
local newsizestr
91+
local newsizestr nobreak=0
9292
doProgress "- waiting for XPrivacy export to complete" 2
9393
while [[ $sleepcount -lt 10 ]] # 20s should be sufficient, else something went wrong
9494
do
@@ -98,19 +98,24 @@ getXPrivacy() {
9898
newsize=(${newsizestr//[$'\r']})
9999
if [[ $newsize -eq 0 ]]; then
100100
sleepcount+=1
101-
doProgress " + export started, file still empty" 4
101+
doProgress " + export started, file still empty\r" 4 n
102+
nobreak=1
102103
elif [[ $newsize -eq $oldsize ]]; then # not growing anymore
103104
doProgress " + export seems complete, final size: ${newsize} bytes" 4
105+
nobreak=0
104106
break
105107
else
106108
oldsize=$newsize
107-
doProgress " + export running, current size: ${newsize} bytes" 4
109+
doProgress " + export running, current size: ${newsize} bytes\r" 4 n
110+
nobreak=1
108111
fi
109112
else
110113
sleepcount+=1
111-
doProgress " + Loop ${sleepcount}, file not yet there" 4
114+
doProgress " + Loop ${sleepcount}, file not yet there\r" 4 n
115+
nobreak=1
112116
fi
113117
done
118+
[[ $nobreak -ne 0 ]] && doProgress "" 4
114119
if [[ -n "$(adb ${ADBOPTS} shell ls ${filename%/*}/ | grep ${filename##*/})" ]]; then
115120
sleep 2 # just another safeguard to ensure export is complete
116121
local msg="$((adb ${ADBOPTS} pull ${filename} "${CONFDIR}/xprivacy.xml") 2>&1)"

0 commit comments

Comments
 (0)