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