+ option -cr ; fix updater [(-U) for next time]
This commit is contained in:
parent
cf31246246
commit
846eb00832
|
@ -1,5 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# version: 0.0.17
|
# version: 0.0.18
|
||||||
# file: upd
|
# file: upd
|
||||||
# Folder: /usr/local/bin
|
# Folder: /usr/local/bin
|
||||||
# By echolib
|
# By echolib
|
||||||
|
@ -101,6 +101,11 @@ case "$1" in
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
-cr)
|
||||||
|
upd_cr=true
|
||||||
|
upd__check_reboot
|
||||||
|
;;
|
||||||
|
|
||||||
list|-l)
|
list|-l)
|
||||||
(( `cat "$upd_file_check" | wc -l` > 0 )) \
|
(( `cat "$upd_file_check" | wc -l` > 0 )) \
|
||||||
&& upd__prepare_show \
|
&& upd__prepare_show \
|
||||||
|
|
|
@ -56,12 +56,9 @@ upd__prepare_show
|
||||||
}
|
}
|
||||||
|
|
||||||
#======================================================================
|
#======================================================================
|
||||||
# Prepare datas to show & show resume
|
# Check and show if reboot is required
|
||||||
#======================================================================
|
#======================================================================
|
||||||
upd__prepare_show() {
|
upd__check_reboot() {
|
||||||
echo -ne "\r\033[2K"
|
|
||||||
upd -vv
|
|
||||||
echo
|
|
||||||
|
|
||||||
upd__reboot_set() {
|
upd__reboot_set() {
|
||||||
upd_reboot="$Pp_Grey ${C_Red}Reboot$NC required"
|
upd_reboot="$Pp_Grey ${C_Red}Reboot$NC required"
|
||||||
|
@ -82,6 +79,27 @@ case "$arch" in
|
||||||
;;
|
;;
|
||||||
esac
|
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}
|
C_NBR=${C_Green}
|
||||||
upd_nbr=`cat "$upd_file_check" | wc -l`
|
upd_nbr=`cat "$upd_file_check" | wc -l`
|
||||||
(( $upd_nbr > 0 )) \
|
(( $upd_nbr > 0 )) \
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
|
|
||||||
upd__help() {
|
upd__help() {
|
||||||
cat << EOHELP
|
cat << EOHELP
|
||||||
# upd : System Updater
|
# upd : System Updater (check for updates and show them)
|
||||||
readme : Show readme
|
readme : Show readme
|
||||||
check | -c : Check for updates (or just type upd)
|
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)
|
list | -l : List updates (Check if none)
|
||||||
-v : Show Installed version
|
-v : Show Installed version
|
||||||
-vv : Show if new version available
|
-vv : Show if new version available
|
||||||
|
|
|
@ -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 "var/lib/$app_name/" "/var/lib/$app_name/"
|
||||||
rsync -a --delete "etc/$app_name/" "/etc/$app_name/"
|
rsync -a --delete "etc/$app_name/" "/etc/$app_name/"
|
||||||
|
|
||||||
upd -v
|
|
||||||
|
|
||||||
rm -rf "/tmp/${app_name}-main"
|
rm -rf "/tmp/${app_name}-main"
|
||||||
rm -f "/tmp/${app_name}-main.tar.gz"
|
rm -f "/tmp/${app_name}-main.tar.gz"
|
||||||
|
|
||||||
|
bash
|
||||||
|
upd -v
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue