Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloudpi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornachoparker <nacho@ownyourbits.com>2017-04-04 18:19:48 +0300
committernachoparker <nacho@ownyourbits.com>2017-04-04 18:38:21 +0300
commit1c19f4c3620d5bc4b13458306ab29587890e2cee (patch)
tree07b4da381c0b49429ca11a49657cf72120fd52d6
parenteaf3fe7c7b4ea61efde1bfacc6437af7ebd497bb (diff)
fix ncp-update with no internet accessv0.5.6
-rwxr-xr-xbin/ncp-check-updates5
-rwxr-xr-xbin/ncp-check-version15
-rwxr-xr-xbin/ncp-test-updates2
-rwxr-xr-xbin/ncp-update21
-rwxr-xr-xnextcloud.sh15
5 files changed, 44 insertions, 14 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"
diff --git a/nextcloud.sh b/nextcloud.sh
index a8d651b4..46059c6f 100755
--- a/nextcloud.sh
+++ b/nextcloud.sh
@@ -264,23 +264,12 @@ EOF
chmod a+x /etc/cron.daily/ncp-check-version
- cat > /usr/local/bin/ncp-check-version <<'EOF'
-#!/bin/bash
-[ $(id -u) -ne 0 ] && exit 1
-git clone -q --depth 1 https://github.com/nachoparker/nextcloud-raspbian-generator.git /tmp/ncp-check-tmp
-cd /tmp/ncp-check-tmp
-git describe --always --tags > /var/run/.ncp-latest-version
-cd /
-rm -rf /tmp/ncp-check-tmp
-EOF
- chmod a+x /usr/local/bin/ncp-check-version
-
-
cat > /usr/local/bin/ncp-update <<'EOF'
#!/bin/bash
+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
+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"