New version ; fix check + updater
This commit is contained in:
parent
909bfe6de6
commit
296fbfffe2
|
@ -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}'
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -19,21 +19,19 @@ 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" ]] \
|
||||||
tar -xzf upd-main.tar.gz
|
&& echo "! Download error" \
|
||||||
cd upd-main
|
&& return
|
||||||
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
|
tar -xzf upd-main.tar.gz
|
||||||
upd_cur=`awk 'NR==2 {print $3}' "/usr/local/bin/upd"`
|
cd upd-main
|
||||||
echo "# upd updated to: $upd_cur"
|
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
|
# Check
|
||||||
rm -f upd-main.tar.gz
|
upd_cur=`awk 'NR==2 {print $3}' "/usr/local/bin/upd"`
|
||||||
else
|
echo "# upd updated to: $upd_cur"
|
||||||
echo "! Download error"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
rm -rf /tmp/upd-main
|
||||||
|
rm -f upd-main.tar.gz
|
||||||
|
|
Loading…
Reference in New Issue