diff options
author | nachoparker <nacho@ownyourbits.com> | 2017-04-04 18:19:48 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2017-04-04 18:38:21 +0300 |
commit | 1c19f4c3620d5bc4b13458306ab29587890e2cee (patch) | |
tree | 07b4da381c0b49429ca11a49657cf72120fd52d6 /bin | |
parent | eaf3fe7c7b4ea61efde1bfacc6437af7ebd497bb (diff) |
fix ncp-update with no internet accessv0.5.6
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ncp-check-updates | 5 | ||||
-rwxr-xr-x | bin/ncp-check-version | 15 | ||||
-rwxr-xr-x | bin/ncp-test-updates | 2 | ||||
-rwxr-xr-x | bin/ncp-update | 21 |
4 files changed, 42 insertions, 1 deletions
diff --git a/bin/ncp-check-updates b/bin/ncp-check-updates index 0a483b76..c30176ab 100755 --- a/bin/ncp-check-updates +++ b/bin/ncp-check-updates @@ -1,6 +1,9 @@ #!/bin/bash - cat > /usr/local/bin/ncp-check-updates <<'EOF' + +# print message if an update is available + VERFILE=/var/run/.ncp-latest-version + if ncp-test-updates; then echo -e "\nNextCloudPi \e[1m$( cat $VERFILE )\e[0m available!!" echo -e "update through 'nextcloudpi-config' or type 'sudo ncp-update'" diff --git a/bin/ncp-check-version b/bin/ncp-check-version new file mode 100755 index 00000000..1c97a9d9 --- /dev/null +++ b/bin/ncp-check-version @@ -0,0 +1,15 @@ +#!/bin/bash + +# update latest available version in /var/run/.ncp-latest-version + +[ $(id -u) -ne 0 ] && exit 1 + +ping -W 2 -w 1 -q github.com &>/dev/null || { echo "No internet connectivity"; exit 1; } + +git clone -q --depth 1 https://github.com/nachoparker/nextcloud-raspbian-generator.git /tmp/ncp-check-tmp || exit 1 + +cd /tmp/ncp-check-tmp +git describe --always --tags > /var/run/.ncp-latest-version +cd / + +rm -rf /tmp/ncp-check-tmp diff --git a/bin/ncp-test-updates b/bin/ncp-test-updates index bc7867eb..08617f76 100755 --- a/bin/ncp-test-updates +++ b/bin/ncp-test-updates @@ -1,5 +1,7 @@ #!/bin/bash +# given in disk version information, return 0 if an update is available + NEED_UPDATE=false VERFILE=/var/run/.ncp-latest-version diff --git a/bin/ncp-update b/bin/ncp-update new file mode 100755 index 00000000..12089bf1 --- /dev/null +++ b/bin/ncp-update @@ -0,0 +1,21 @@ +#!/bin/bash + +# update latest NextCloudPi code from github + +ping -W 2 -w 1 -q github.com &>/dev/null || { echo "No internet connectivity"; exit 1; } +echo -e "Downloading updates" +rm -rf /tmp/ncp-update-tmp +git clone -q --depth 1 https://github.com/nachoparker/nextcloud-raspbian-generator.git /tmp/ncp-update-tmp || exit 1 +cd /tmp/ncp-update-tmp + +echo -e "Performing updates" +./update.sh + +VER=$( git describe --always --tags ) +echo $VER > /usr/local/etc/ncp-version +echo $VER > /var/run/.ncp-latest-version + +cd / +rm -rf /tmp/ncp-update-tmp + +echo -e "NextCloudPi updated to version \e[1m$VER\e[0m" |