From ead5328065fc150c6fd61e0330125092ed1c0b73 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Thu, 25 Aug 2022 11:44:41 +0200 Subject: [PATCH] Version 0.1.6 --- CHANGELOG.md | 14 ++++++++++ etc/upd/upd.conf | 14 ++++++++++ usr/local/bin/upd | 50 +++++++++++++++++++----------------- var/lib/upd/CHANGELOG.md | 14 ++++++++++ var/lib/upd/scripts/check | 24 ++++++++--------- var/lib/upd/scripts/updater | 3 ++- var/lib/upd/scripts/upgrader | 2 -- 7 files changed, 82 insertions(+), 39 deletions(-) create mode 100644 CHANGELOG.md create mode 100644 var/lib/upd/CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..de21253 --- /dev/null +++ b/CHANGELOG.md @@ -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 diff --git a/etc/upd/upd.conf b/etc/upd/upd.conf index 414fb3d..a2a4541 100644 --- a/etc/upd/upd.conf +++ b/etc/upd/upd.conf @@ -24,3 +24,17 @@ upd_script_upgrader="/var/lib/upd/scripts/upgrader" # Onlinde Repo 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" + + +#====================================================================== +# 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" diff --git a/usr/local/bin/upd b/usr/local/bin/upd index 583905b..6eaf789 100755 --- a/usr/local/bin/upd +++ b/usr/local/bin/upd @@ -1,5 +1,5 @@ #!/bin/bash -# version: 0.1.5 +# version: 0.1.6 # file: upd # Folder: /usr/local/bin # By echolib @@ -43,6 +43,7 @@ if ! [[ -d "$1" ]];then make) mkdir -p "$1" if__folder "$1" check + exit ;; check) @@ -66,7 +67,7 @@ elif [[ `command -v pacman` ]];then arch="pacman" if__command "checkupdates" [[ `command -v yay` ]] \ - && aur=yay + && aur="yay" else echo "! upd is not yet ready for this System" @@ -79,13 +80,13 @@ fi #====================================================================== if__arch -if__file "/etc/upd/upd.conf" source -if__file "$upd_script_tools" source -if__file "$upd_script_updater" source -if__file "$upd_script_check" source -if__file "$upd_script_clean" source +if__file "/etc/upd/upd.conf" source +if__file "$upd_script_tools" source +if__file "$upd_script_updater" source +if__file "$upd_script_check" source +if__file "$upd_script_clean" 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__file "$upd_file_check" create @@ -95,20 +96,23 @@ if__file "$upd_file_check" create && if__file "$upd_file_check_aur" create case "$1" in - readme) if__file "/var/lib/upd/README.md" read ;; - help|--help|-h) upd__help ;; - ""|check|-c) check__OPTIONS ;; - clean|-C) clean__OPTIONS ;; - -cr) upd_cr=true;upd__check_reboot ;; - list|-l) upd__list ;; - version|-v) awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/upd" ;; - -vv) script__versions ;; - -vvv) verbose=true;script__versions ;; - -U) Updater ;; - -u) sysup="system";upg__main ;; - -f) sysup="full";upg__main ;; - --arch-mirror|-am) arch__mirror ;; - --arch-repair|-ar) arch__repair ;; - -A) sysup="aur";upg__main ;; + readme) if__file "/var/lib/upd/README.md" read ;; + help|--help|-h) upd__help ;; + ""|check|-c) check__OPTIONS ;; + clean|-C) clean__OPTIONS ;; + -cr) upd_cr=true;upd__check_reboot ;; + list|-l) upd__list ;; + version|-v) awk 'NR==2 {print "# Installed:",$3}' \ + "/usr/local/bin/upd" ;; + -vv) script__versions ;; + -vvv) verbose=true;script__versions ;; + -U) Updater ;; + -u) sysup="system";upg__main ;; + -f) sysup="full";upg__main ;; + --arch-mirror|-am) arch__mirror ;; + --arch-repair|-ar) arch__repair ;; + -A) sysup="aur";upg__main ;; *) echo "! Bad argument '$1' : see upd --help" ;; esac + +exit diff --git a/var/lib/upd/CHANGELOG.md b/var/lib/upd/CHANGELOG.md new file mode 100644 index 0000000..de21253 --- /dev/null +++ b/var/lib/upd/CHANGELOG.md @@ -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 diff --git a/var/lib/upd/scripts/check b/var/lib/upd/scripts/check index b3a5f4c..384e117 100644 --- a/var/lib/upd/scripts/check +++ b/var/lib/upd/scripts/check @@ -11,7 +11,7 @@ check__OPTIONS() { echo -ne "# Checking for updates..." case "$arch" in - pacman) upd__check_arch ;; + pacman) upd__check_arch ;; apt) upd__sudoroot;upd__check_deb ;; esac } @@ -35,7 +35,6 @@ upd__prepare_show # Check for updates from {deb]ian #====================================================================== upd__check_deb() { -echo sudo apt-get update -qq upd_file_tmp_apt=`mktemp` @@ -65,9 +64,9 @@ upd__prepare_show # Check and show if reboot is required #====================================================================== upd__check_reboot() { - + 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" } @@ -87,14 +86,13 @@ case "$arch" in esac # Reboot message only: if called from option -cr -[[ $upd_cr ]] || exit +[[ $upd_cr ]] || return ! [[ $upd_reboot ]] \ && echo "# No need to reboot" \ && exit echo -e "$upd_reboot" exit 137 - } @@ -103,7 +101,7 @@ exit 137 #====================================================================== upd__prepare_show() { echo -ne "\r\033[2K" -upd -vv +script__versions echo upd__check_reboot @@ -147,12 +145,12 @@ upd__show() { upd__filters() { printf '%b%b%b%b%b\n' \ - "$C_Color$list$NC " \ - "$C_Color$pkg$NC|" \ - "$C_Yellow$old$NC|" \ - "$C_Grey$sep$NC|" \ - "$C_Green$new$NC" \ - >> "$upd_file_tmp" + "$C_Color$list$NC " \ + "$C_Color$pkg$NC|" \ + "$C_Yellow$old$NC|" \ + "$C_Grey$sep$NC|" \ + "$C_Green$new$NC" \ + >> "$upd_file_tmp" } upd_file_tmp=`mktemp` diff --git a/var/lib/upd/scripts/updater b/var/lib/upd/scripts/updater index 91b8739..2c41a72 100644 --- a/var/lib/upd/scripts/updater +++ b/var/lib/upd/scripts/updater @@ -25,7 +25,8 @@ if [[ `sort -V <<< "$versions" | tail -1` == $v_cur ]];then && s_onl=" > online: $v_onl" echo "# $app_name is up to date (version: $v_cur$s_onl)" upd_err=true - return 0 + return + else echo -e "- $app_name $C_Yellow$v_cur$NC -> $C_Green$v_onl$NC" fi diff --git a/var/lib/upd/scripts/upgrader b/var/lib/upd/scripts/upgrader index 1ae484b..3ef1260 100644 --- a/var/lib/upd/scripts/upgrader +++ b/var/lib/upd/scripts/upgrader @@ -13,7 +13,6 @@ case "$sysup" in system) case "$arch" in pacman) - clear upd__check_arch (( $upd_nbr == 0 )) \ && exit @@ -22,7 +21,6 @@ case "$sysup" in ;; apt) - clear upd__check_deb (( $upd_nbr == 0 )) \ && exit