Skip to content

Commit 0d7cdd9

Browse files
committed
Allow logging to be disabled temporarily by functions
1 parent 908b7ad commit 0d7cdd9

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

usr/bin/tik

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ tik_module="tik"
1717

1818
# Start logging
1919
exec 2> >(exec tee -i -a "${tik_log}" >&2)
20+
logging=true
2021
log "[START] $0"
2122

2223
# Check for debug mode

usr/lib/tik/lib/tik-functions

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
. /usr/lib/tik/lib/cenity
66

77
log(){
8-
echo "[${tik_module}][$(date +"%Y%m%d-%T")][LOG] $*" 1>&2
8+
if $logging; then
9+
echo "[${tik_module}][$(date +"%Y%m%d-%T")][LOG] $*" 1>&2
10+
fi
911
}
1012

1113
warn() {
@@ -49,10 +51,11 @@ d_opt(){
4951
retval=0
5052
if $gui; then
5153
result="$(zenity "$@")" || retval=$?
54+
log "[zenity][${retval}][${result}] $@"
5255
else
5356
cenity result "$@" || retval=$?
57+
log "[cenity][${retval}][${result}] $@"
5458
fi
55-
log "[zenity][${retval}][${result}] $@"
5659
return $retval
5760
}
5861

usr/lib/tik/modules/post/15-encrypt

+3
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,9 @@ display_recoveryKey() {
184184
[ "${tik_encrypt_mode}" == 0 ] && message=${defaultmsg}
185185
[ "${tik_encrypt_mode}" == 1 ] && message=${fallbackmsg}
186186
log "[display_recoveryKey] displaying recovery key"
187+
logging=false
187188
d --width=500 --height=500 --no-wrap --warning --icon=security-high-symbolic --title="Encryption Recovery Key" --text="${message}You may optionally scan the recovery key off screen:\n<span face='monospace'>$(qrencode ${key} -t UTF8i)</span>\nFor more information please visit <tt>https://aeondesktop.org/encrypt</tt>"
189+
logging=true
188190
log "[display_recoveryKey] recovery key dialogue dismissed"
189191
}
190192

@@ -193,6 +195,7 @@ add_key() {
193195
d --width=500 --height=300 --no-wrap --warning --icon=security-high-symbolic --title="Set Encryption Passphrase" --text="This ${TIK_OS_NAME} system is encrypted and will require a Passphrase on every boot\n\nYou will be prompted to set the Passphrase on the next screen\n\nFor more information please visit <tt>https://aeondesktop.org/encrypt</tt>"
194196
log "[add_key] Fallback Mode - Prompting user for passphrase for ${cryptpart}"
195197
# Not using 'd' function to avoid logging the password
198+
# FIXME - Now use 'd' function and logging=false
196199
while true
197200
do
198201
if $gui; then

0 commit comments

Comments
 (0)