From 296fbfffe206c04dc4bd447ebf57d2d77765d7d3 Mon Sep 17 00:00:00 2001 From: Cyrille L Date: Thu, 24 Mar 2022 12:32:29 +0100 Subject: [PATCH] New version ; fix check + updater --- usr/local/bin/upd | 7 ++++++- var/lib/upd/scripts/help | 4 ++-- var/lib/upd/scripts/updater | 30 ++++++++++++++---------------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/usr/local/bin/upd b/usr/local/bin/upd index 055d9c1..2e3354f 100755 --- a/usr/local/bin/upd +++ b/usr/local/bin/upd @@ -1,5 +1,5 @@ #!/bin/bash -# version: 0.0.7 +# version: 0.0.8 # file: upd # Folder: /usr/local/bin # By echolib @@ -78,6 +78,10 @@ if__file "$upd_file_check" create if__file "$upd_script_check" source case "$1" in + "") + upd check + ;; + check|-c) echo -ne "# Checking for updates..." case "$arch" in @@ -102,6 +106,7 @@ case "$1" in -vv) awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/upd" + if__command curl*- curl -s "$upd_repo_upd" | awk 'NR==2 {print "# Available:",$3}' ;; diff --git a/var/lib/upd/scripts/help b/var/lib/upd/scripts/help index a306370..0fac5dd 100644 --- a/var/lib/upd/scripts/help +++ b/var/lib/upd/scripts/help @@ -7,9 +7,9 @@ upd__help() { cat << EOHELP # upd : System Updater - check | -c : Check for updates + check | -c : Check for updates (or just type upd) list | -l : List updates (Check if none) - -v : Show Installeed version + -v : Show Installed version -vv : Show Installed and Available versions -U : Check and Update upd EOHELP diff --git a/var/lib/upd/scripts/updater b/var/lib/upd/scripts/updater index d16e0a8..238fdfc 100644 --- a/var/lib/upd/scripts/updater +++ b/var/lib/upd/scripts/updater @@ -19,21 +19,19 @@ printf -v versions '%s\n%s' "$upd_cur" "$upd_onl" # Get archive cd /tmp curl -L -o upd-main.tar.gz "$upd_repo_tar" 2>/dev/null -if [[ -f "upd-main.tar.gz" ]];then - tar -xzf upd-main.tar.gz - cd upd-main - rsync -a --delete "usr/local/bin/" "/usr/local/bin" - rsync -a --delete "var/lib/upd/" "/var/lib/upd/" - rsync -a --delete "etc/upd/" "/etc/upd/" +! [[ -f "upd-main.tar.gz" ]] \ + && echo "! Download error" \ + && return - # Check - upd_cur=`awk 'NR==2 {print $3}' "/usr/local/bin/upd"` - echo "# upd updated to: $upd_cur" - - rm -rf /tmp/upd-main - rm -f upd-main.tar.gz -else - echo "! Download error" -fi +tar -xzf upd-main.tar.gz +cd upd-main +rsync -a --delete "usr/local/bin/" "/usr/local/bin" +rsync -a --delete "var/lib/upd/" "/var/lib/upd/" +rsync -a --delete "etc/upd/" "/etc/upd/" -} +# Check +upd_cur=`awk 'NR==2 {print $3}' "/usr/local/bin/upd"` +echo "# upd updated to: $upd_cur" + +rm -rf /tmp/upd-main +rm -f upd-main.tar.gz