New version ; fix check + updater
This commit is contained in:
parent
909bfe6de6
commit
296fbfffe2
|
@ -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}'
|
||||
;;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
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/"
|
||||
|
||||
rm -rf /tmp/upd-main
|
||||
rm -f upd-main.tar.gz
|
||||
else
|
||||
echo "! Download error"
|
||||
fi
|
||||
# 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
|
||||
|
|
Loading…
Reference in New Issue