fix: auto restart of KIAUH after update (#781)

* fixed auto update

* fixed the restarting logic

* testing

* removed test

* fix: colored output and remove subshell usage in kiauh_update_dialog

---------

Co-authored-by: dw-0 <th33xitus@gmail.com>
This commit is contained in:
Lazox12
2026-04-19 20:10:36 +02:00
committed by GitHub
parent 2175bd55f9
commit aa0609d143
+20 -6
View File
@@ -15,18 +15,30 @@ clear -x
# make sure we have the correct permissions while running the script # make sure we have the correct permissions while running the script
umask 022 umask 022
# gets the path where this script is located
KIAUH_SRCDIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)
# colors
white="\033[37m"
cyan="\033[96m"
red="\033[91m"
yellow="\033[93m"
green="\033[92m"
#===================================================# #===================================================#
#=================== UPDATE KIAUH ==================# #=================== UPDATE KIAUH ==================#
#===================================================# #===================================================#
function update_kiauh() { function update_kiauh() {
status_msg "Updating KIAUH ..." echo "Updating KIAUH ..."
cd "${KIAUH_SRCDIR}" cd "${KIAUH_SRCDIR}"
git reset --hard && git pull git reset --hard && git pull
ok_msg "Update complete! Please restart KIAUH." echo "Update complete! Restarting..."
exit 0 sleep 1
exec "$0" "$@" # restarts the script
} }
#===================================================# #===================================================#
@@ -65,16 +77,18 @@ function kiauh_update_dialog() {
echo -e "\-------------------------------------------------------/" echo -e "\-------------------------------------------------------/"
local yn local yn
read -p "${cyan}###### Do you want to update now? (Y/n):${white} " yn echo -ne "${cyan}###### Do you want to update now? (Y/n):${white} "
read yn
while true; do while true; do
case "${yn}" in case "${yn}" in
Y|y|Yes|yes|"") Y|y|Yes|yes|"")
do_action "update_kiauh" update_kiauh
break;; break;;
N|n|No|no) N|n|No|no)
break;; break;;
*) *)
deny_action "kiauh_update_dialog";; echo -e "${red}Invalid input. Please try again.${white}"
kiauh_update_dialog;;
esac esac
done done
} }