From b20cda1d155b7888944806d0c6b2f61c2a0a28dd Mon Sep 17 00:00:00 2001 From: th33xitus Date: Tue, 13 Oct 2020 11:41:57 +0200 Subject: [PATCH] fix: new function to fix #26 --- kiauh.sh | 1 + scripts/functions.sh | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/kiauh.sh b/kiauh.sh index b57d11b..e505991 100755 --- a/kiauh.sh +++ b/kiauh.sh @@ -99,5 +99,6 @@ clear_msg(){ } check_euid +init_ini kiauh_status main_menu \ No newline at end of file diff --git a/scripts/functions.sh b/scripts/functions.sh index 4beee9f..cf1d88c 100755 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -256,4 +256,23 @@ create_shell_command_example(){ sed -i "$LINE_COUNT $entry" $PRINTER_CFG done fi +} + +init_ini(){ + [ ! -f $INI_FILE ] && touch $INI_FILE + if [ ! $(grep -E "^backup_before_update=." $INI_FILE) ]; then + echo -e "\nbackup_before_update=false\c" >> $INI_FILE + fi + if [ ! $(grep -E "^previous_origin_state=[[:alnum:]]" $INI_FILE) ]; then + echo -e "\nprevious_origin_state=0\c" >> $INI_FILE + fi + if [ ! $(grep -E "^previous_smoothing_state=[[:alnum:]]" $INI_FILE) ]; then + echo -e "\nprevious_smoothing_state=0\c" >> $INI_FILE + fi + if [ ! $(grep -E "^previous_shaping_state=[[:alnum:]]" $INI_FILE) ]; then + echo -e "\nprevious_shaping_state=0\c" >> $INI_FILE + fi + if [ ! $(grep -E "^logupload_accepted=." $INI_FILE) ]; then + echo -e "\nlogupload_accepted=false\c" >> $INI_FILE + fi } \ No newline at end of file