From 846eb00832872fef747fdeedb304030ae8943c32 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Sun, 10 Apr 2022 19:39:39 +0200 Subject: [PATCH] + option -cr ; fix updater [(-U) for next time] --- usr/local/bin/upd | 7 ++++++- var/lib/upd/scripts/check | 30 ++++++++++++++++++++++++------ var/lib/upd/scripts/help | 4 +++- var/lib/upd/scripts/updater | 5 +++-- 4 files changed, 36 insertions(+), 10 deletions(-) diff --git a/usr/local/bin/upd b/usr/local/bin/upd index ce83219..699281f 100755 --- a/usr/local/bin/upd +++ b/usr/local/bin/upd @@ -1,5 +1,5 @@ #!/bin/bash -# version: 0.0.17 +# version: 0.0.18 # file: upd # Folder: /usr/local/bin # By echolib @@ -100,6 +100,11 @@ case "$1" in ;; esac ;; + + -cr) + upd_cr=true + upd__check_reboot + ;; list|-l) (( `cat "$upd_file_check" | wc -l` > 0 )) \ diff --git a/var/lib/upd/scripts/check b/var/lib/upd/scripts/check index a3cdcf8..dfa6e78 100644 --- a/var/lib/upd/scripts/check +++ b/var/lib/upd/scripts/check @@ -56,13 +56,10 @@ upd__prepare_show } #====================================================================== -# Prepare datas to show & show resume +# Check and show if reboot is required #====================================================================== -upd__prepare_show() { -echo -ne "\r\033[2K" -upd -vv -echo - +upd__check_reboot() { + upd__reboot_set() { upd_reboot="$Pp_Grey ${C_Red}Reboot$NC required" upd_inf="$I_Red" @@ -82,6 +79,27 @@ case "$arch" in ;; esac +# Reboot message only: if called from option -cr +if [[ $upd_cr ]];then + if [[ $upd_reboot ]];then + echo -e "$upd_reboot" + exit 137 + else + exit 0 + fi +fi +} + +#====================================================================== +# Prepare datas to show & show resume +#====================================================================== +upd__prepare_show() { +echo -ne "\r\033[2K" +upd -vv +echo + +upd__check_reboot + C_NBR=${C_Green} upd_nbr=`cat "$upd_file_check" | wc -l` (( $upd_nbr > 0 )) \ diff --git a/var/lib/upd/scripts/help b/var/lib/upd/scripts/help index e3aeffc..b9da4a4 100644 --- a/var/lib/upd/scripts/help +++ b/var/lib/upd/scripts/help @@ -6,9 +6,11 @@ upd__help() { cat << EOHELP -# upd : System Updater +# upd : System Updater (check for updates and show them) readme : Show readme check | -c : Check for updates (or just type upd) + -cr : Put upd -cr in bashrc profile to check if reboot needed + (useless if you put upd) list | -l : List updates (Check if none) -v : Show Installed version -vv : Show if new version available diff --git a/var/lib/upd/scripts/updater b/var/lib/upd/scripts/updater index 8e803f7..778f558 100644 --- a/var/lib/upd/scripts/updater +++ b/var/lib/upd/scripts/updater @@ -54,8 +54,9 @@ cp -f "usr/local/bin/$app_name" "/usr/local/bin/$app_name" rsync -a --delete "var/lib/$app_name/" "/var/lib/$app_name/" rsync -a --delete "etc/$app_name/" "/etc/$app_name/" -upd -v - rm -rf "/tmp/${app_name}-main" rm -f "/tmp/${app_name}-main.tar.gz" + +bash +upd -v }