New version ; fix check + updater

This commit is contained in:
Cyrille L 2022-03-24 12:32:29 +01:00
parent 909bfe6de6
commit 296fbfffe2
3 changed files with 22 additions and 19 deletions

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# version: 0.0.7 # version: 0.0.8
# file: upd # file: upd
# Folder: /usr/local/bin # Folder: /usr/local/bin
# By echolib # By echolib
@ -78,6 +78,10 @@ if__file "$upd_file_check" create
if__file "$upd_script_check" source if__file "$upd_script_check" source
case "$1" in case "$1" in
"")
upd check
;;
check|-c) check|-c)
echo -ne "# Checking for updates..." echo -ne "# Checking for updates..."
case "$arch" in case "$arch" in
@ -102,6 +106,7 @@ case "$1" in
-vv) -vv)
awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/upd" awk 'NR==2 {print "# Installed:",$3}' "/usr/local/bin/upd"
if__command curl*-
curl -s "$upd_repo_upd" | awk 'NR==2 {print "# Available:",$3}' curl -s "$upd_repo_upd" | awk 'NR==2 {print "# Available:",$3}'
;; ;;

View File

@ -7,9 +7,9 @@
upd__help() { upd__help() {
cat << EOHELP cat << EOHELP
# upd : System Updater # upd : System Updater
check | -c : Check for updates check | -c : Check for updates (or just type upd)
list | -l : List updates (Check if none) list | -l : List updates (Check if none)
-v : Show Installeed version -v : Show Installed version
-vv : Show Installed and Available versions -vv : Show Installed and Available versions
-U : Check and Update upd -U : Check and Update upd
EOHELP EOHELP

View File

@ -19,7 +19,10 @@ printf -v versions '%s\n%s' "$upd_cur" "$upd_onl"
# Get archive # Get archive
cd /tmp cd /tmp
curl -L -o upd-main.tar.gz "$upd_repo_tar" 2>/dev/null curl -L -o upd-main.tar.gz "$upd_repo_tar" 2>/dev/null
if [[ -f "upd-main.tar.gz" ]];then ! [[ -f "upd-main.tar.gz" ]] \
&& echo "! Download error" \
&& return
tar -xzf upd-main.tar.gz tar -xzf upd-main.tar.gz
cd upd-main cd upd-main
rsync -a --delete "usr/local/bin/" "/usr/local/bin" rsync -a --delete "usr/local/bin/" "/usr/local/bin"
@ -32,8 +35,3 @@ if [[ -f "upd-main.tar.gz" ]];then
rm -rf /tmp/upd-main rm -rf /tmp/upd-main
rm -f upd-main.tar.gz rm -f upd-main.tar.gz
else
echo "! Download error"
fi
}