Version 0.1.6

This commit is contained in:
Cyrille L 2022-08-25 11:44:41 +02:00
parent df4fe68228
commit ead5328065
7 changed files with 82 additions and 39 deletions

14
CHANGELOG.md Normal file
View File

@ -0,0 +1,14 @@
# Changelog
UPD: Little tool to check and show system updates (archlinux, debian)
- Repository: https://git.a-lec.org/echolib/upd
- Issues: https://git.a-lec.org/echolib/upd/-/issues
- Changelog: https://git.a-lec.org/echolib/upd/-/blob/main/CHANGELOG.md
- License: https://git.a-lec.org/echolib/upd/-/blob/main/LICENSE
## [0.1.6]
### Fix
- exit after checking for available new upd, stopping other jobs
### add
- Settings colors in conf file

View File

@ -24,3 +24,17 @@ upd_script_upgrader="/var/lib/upd/scripts/upgrader"
# Onlinde Repo # Onlinde Repo
repo="https://git.a-lec.org/echolib/upd/-/raw/main/usr/local/bin/upd" repo="https://git.a-lec.org/echolib/upd/-/raw/main/usr/local/bin/upd"
repo_tar="https://git.a-lec.org/echolib/upd/-/archive/main/upd-main.tar.gz" repo_tar="https://git.a-lec.org/echolib/upd/-/archive/main/upd-main.tar.gz"
#======================================================================
# Set Colors
#======================================================================
NC="\e[0m"
C_Blue="\e[34m"
C_Cyan="\e[36m"
C_Green="\e[32m"
C_Grey="\e[2m"
C_Pink="\e[35m"
C_Red="\e[31m"
C_White="\e[1m"
C_Yellow="\e[33m"

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# version: 0.1.5 # version: 0.1.6
# file: upd # file: upd
# Folder: /usr/local/bin # Folder: /usr/local/bin
# By echolib # By echolib
@ -43,6 +43,7 @@ if ! [[ -d "$1" ]];then
make) make)
mkdir -p "$1" mkdir -p "$1"
if__folder "$1" check if__folder "$1" check
exit
;; ;;
check) check)
@ -66,7 +67,7 @@ elif [[ `command -v pacman` ]];then
arch="pacman" arch="pacman"
if__command "checkupdates" if__command "checkupdates"
[[ `command -v yay` ]] \ [[ `command -v yay` ]] \
&& aur=yay && aur="yay"
else else
echo "! upd is not yet ready for this System" echo "! upd is not yet ready for this System"
@ -79,13 +80,13 @@ fi
#====================================================================== #======================================================================
if__arch if__arch
if__file "/etc/upd/upd.conf" source if__file "/etc/upd/upd.conf" source
if__file "$upd_script_tools" source if__file "$upd_script_tools" source
if__file "$upd_script_updater" source if__file "$upd_script_updater" source
if__file "$upd_script_check" source if__file "$upd_script_check" source
if__file "$upd_script_clean" source if__file "$upd_script_clean" source
if__file "$upd_script_upgrader" source if__file "$upd_script_upgrader" source
if__file "$upd_script_help" source if__file "$upd_script_help" source
if__folder "$upd_dir_home" make if__folder "$upd_dir_home" make
if__file "$upd_file_check" create if__file "$upd_file_check" create
@ -95,20 +96,23 @@ if__file "$upd_file_check" create
&& if__file "$upd_file_check_aur" create && if__file "$upd_file_check_aur" create
case "$1" in case "$1" in
readme) if__file "/var/lib/upd/README.md" read ;; readme) if__file "/var/lib/upd/README.md" read ;;
help|--help|-h) upd__help ;; help|--help|-h) upd__help ;;
""|check|-c) check__OPTIONS ;; ""|check|-c) check__OPTIONS ;;
clean|-C) clean__OPTIONS ;; clean|-C) clean__OPTIONS ;;
-cr) upd_cr=true;upd__check_reboot ;; -cr) upd_cr=true;upd__check_reboot ;;
list|-l) upd__list ;; list|-l) upd__list ;;
version|-v) awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/upd" ;; version|-v) awk 'NR==2 {print "# Installed:",$3}' \
-vv) script__versions ;; "/usr/local/bin/upd" ;;
-vvv) verbose=true;script__versions ;; -vv) script__versions ;;
-U) Updater ;; -vvv) verbose=true;script__versions ;;
-u) sysup="system";upg__main ;; -U) Updater ;;
-f) sysup="full";upg__main ;; -u) sysup="system";upg__main ;;
--arch-mirror|-am) arch__mirror ;; -f) sysup="full";upg__main ;;
--arch-repair|-ar) arch__repair ;; --arch-mirror|-am) arch__mirror ;;
-A) sysup="aur";upg__main ;; --arch-repair|-ar) arch__repair ;;
-A) sysup="aur";upg__main ;;
*) echo "! Bad argument '$1' : see upd --help" ;; *) echo "! Bad argument '$1' : see upd --help" ;;
esac esac
exit

14
var/lib/upd/CHANGELOG.md Normal file
View File

@ -0,0 +1,14 @@
# Changelog
UPD: Little tool to check and show system updates (archlinux, debian)
- Repository: https://git.a-lec.org/echolib/upd
- Issues: https://git.a-lec.org/echolib/upd/-/issues
- Changelog: https://git.a-lec.org/echolib/upd/-/blob/main/CHANGELOG.md
- License: https://git.a-lec.org/echolib/upd/-/blob/main/LICENSE
## [0.1.6]
### Fix
- exit after checking for available new upd, stopping other jobs
### add
- Settings colors in conf file

View File

@ -11,7 +11,7 @@
check__OPTIONS() { check__OPTIONS() {
echo -ne "# Checking for updates..." echo -ne "# Checking for updates..."
case "$arch" in case "$arch" in
pacman) upd__check_arch ;; pacman) upd__check_arch ;;
apt) upd__sudoroot;upd__check_deb ;; apt) upd__sudoroot;upd__check_deb ;;
esac esac
} }
@ -35,7 +35,6 @@ upd__prepare_show
# Check for updates from {deb]ian # Check for updates from {deb]ian
#====================================================================== #======================================================================
upd__check_deb() { upd__check_deb() {
echo
sudo apt-get update -qq sudo apt-get update -qq
upd_file_tmp_apt=`mktemp` upd_file_tmp_apt=`mktemp`
@ -67,7 +66,7 @@ upd__prepare_show
upd__check_reboot() { upd__check_reboot() {
upd__reboot_set() { upd__reboot_set() {
upd_reboot="$Pp_Grey ${C_Red}Reboot$NC required ; $upd_uname > $upd_vmlin" upd_reboot="$P_Grey ${C_Red}Reboot$NC required ; $upd_uname > $upd_vmlin"
upd_inf="$I_Red" upd_inf="$I_Red"
} }
@ -87,14 +86,13 @@ case "$arch" in
esac esac
# Reboot message only: if called from option -cr # Reboot message only: if called from option -cr
[[ $upd_cr ]] || exit [[ $upd_cr ]] || return
! [[ $upd_reboot ]] \ ! [[ $upd_reboot ]] \
&& echo "# No need to reboot" \ && echo "# No need to reboot" \
&& exit && exit
echo -e "$upd_reboot" echo -e "$upd_reboot"
exit 137 exit 137
} }
@ -103,7 +101,7 @@ exit 137
#====================================================================== #======================================================================
upd__prepare_show() { upd__prepare_show() {
echo -ne "\r\033[2K" echo -ne "\r\033[2K"
upd -vv script__versions
echo echo
upd__check_reboot upd__check_reboot
@ -147,12 +145,12 @@ upd__show() {
upd__filters() { upd__filters() {
printf '%b%b%b%b%b\n' \ printf '%b%b%b%b%b\n' \
"$C_Color$list$NC " \ "$C_Color$list$NC " \
"$C_Color$pkg$NC|" \ "$C_Color$pkg$NC|" \
"$C_Yellow$old$NC|" \ "$C_Yellow$old$NC|" \
"$C_Grey$sep$NC|" \ "$C_Grey$sep$NC|" \
"$C_Green$new$NC" \ "$C_Green$new$NC" \
>> "$upd_file_tmp" >> "$upd_file_tmp"
} }
upd_file_tmp=`mktemp` upd_file_tmp=`mktemp`

View File

@ -25,7 +25,8 @@ if [[ `sort -V <<< "$versions" | tail -1` == $v_cur ]];then
&& s_onl=" > online: $v_onl" && s_onl=" > online: $v_onl"
echo "# $app_name is up to date (version: $v_cur$s_onl)" echo "# $app_name is up to date (version: $v_cur$s_onl)"
upd_err=true upd_err=true
return 0 return
else else
echo -e "- $app_name $C_Yellow$v_cur$NC -> $C_Green$v_onl$NC" echo -e "- $app_name $C_Yellow$v_cur$NC -> $C_Green$v_onl$NC"
fi fi

View File

@ -13,7 +13,6 @@ case "$sysup" in
system) system)
case "$arch" in case "$arch" in
pacman) pacman)
clear
upd__check_arch upd__check_arch
(( $upd_nbr == 0 )) \ (( $upd_nbr == 0 )) \
&& exit && exit
@ -22,7 +21,6 @@ case "$sysup" in
;; ;;
apt) apt)
clear
upd__check_deb upd__check_deb
(( $upd_nbr == 0 )) \ (( $upd_nbr == 0 )) \
&& exit && exit