diff --git a/scripts/klipper.sh b/scripts/klipper.sh index f307c64..f55adb9 100644 --- a/scripts/klipper.sh +++ b/scripts/klipper.sh @@ -48,9 +48,12 @@ function klipper_setup_dialog(){ status_msg "Initializing Klipper installation ..." ### return early if klipper already exists - if [ -n "$(klipper_exists)" ]; then + local klipper_services + klipper_services=$(klipper_exists) + if [ -n "${klipper_services}" ]; then local error="At least one Klipper service is already installed:" - for s in $(klipper_exists); do + for s in ${klipper_services}; do + log "Found Klipper service: ${s}" error="${error}\n ➔ ${s}" done print_error "${error}" && return diff --git a/scripts/utilities.sh b/scripts/utilities.sh index ccc0f2f..d6fa4fb 100644 --- a/scripts/utilities.sh +++ b/scripts/utilities.sh @@ -13,6 +13,7 @@ set -e ### base variables SYSTEMD="/etc/systemd/system" +LOGFILE="/tmp/kiauh.log" # setting up some frequently used functions check_euid(){ @@ -27,6 +28,15 @@ check_euid(){ fi } +function timestamp() { + date +"[%F %T]" +} + +function log() { + local message="${1}" + echo -e "$(timestamp) ${message}" | tr -s " " >> "${LOGFILE}" +} + check_klipper_cfg_path(){ source_kiauh_ini if [ -z "${klipper_cfg_loc}" ]; then