diff --git a/kiauh.sh b/kiauh.sh index 868547b..ecadc64 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -49,6 +49,7 @@ function kiauh_update_avail(){ } check_euid +init_logfile set_globals init_ini kiauh_update_avail diff --git a/scripts/ui/main_menu.sh b/scripts/ui/main_menu.sh index 3f43eea..3cbfe76 100755 --- a/scripts/ui/main_menu.sh +++ b/scripts/ui/main_menu.sh @@ -25,14 +25,20 @@ function main_ui(){ echo -e "| | KlipperScreen: $(klipperscreen_status)|" echo -e "| 6) [Settings] | Telegram Bot: $(get_telegram_bot_status)|" echo -e "| | |" - echo -e "| $(get_kiauh_version)| Octoprint: $(octoprint_status)|" + echo -e "| $(print_kiauh_version)| Octoprint: $(octoprint_status)|" quit_footer } function get_kiauh_version(){ local version cd "${SRCDIR}/kiauh" - version="$(printf "%-20s" "$(git describe HEAD --always --tags | cut -d "-" -f 1,2)")" + version="$(git describe HEAD --always --tags | cut -d "-" -f 1,2)" + echo "${version}" +} + +function print_kiauh_version(){ + local version + version="$(printf "%-20s" "$(get_kiauh_version)")" echo "${cyan}${version}${white}" } diff --git a/scripts/utilities.sh b/scripts/utilities.sh index 61fd292..4ab6629 100644 --- a/scripts/utilities.sh +++ b/scripts/utilities.sh @@ -79,6 +79,17 @@ function timestamp() { date +"[%F %T]" } +function init_logfile() { + local log="/tmp/kiauh.log" + { + echo -e "#================================================================#" + echo -e "# New KIAUH session started on: $(date) #" + echo -e "#================================================================#" + echo -e "KIAUH $(get_kiauh_version)" + echo -e "#================================================================#" + } >> "${log}" +} + function log_info() { local message="${1}" log="${LOGFILE}" echo -e "$(timestamp) ${message}" | tr -s " " >> "${log}"