+ option -cr ; fix updater [(-U) for next time]

This commit is contained in:
Cyrille L 2022-04-10 19:39:39 +02:00
parent cf31246246
commit 846eb00832
4 changed files with 36 additions and 10 deletions

View File

@ -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 )) \

View File

@ -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 )) \

View File

@ -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

View File

@ -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
}