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 19:25:23 +0300
committernachoparker <nacho@ownyourbits.com>2017-04-04 19:25:23 +0300
commitc60ee017ab7a5e5cbbcf7166e87806a878be0e11 (patch)
tree97ae7571e340204f67eb256e0d4500382d01d34f
parent1c19f4c3620d5bc4b13458306ab29587890e2cee (diff)
protect ncp-update from self modificationsv0.5.7
-rwxr-xr-xbin/ncp-update29
-rwxr-xr-xnextcloud.sh29
2 files changed, 32 insertions, 26 deletions
diff --git a/bin/ncp-update b/bin/ncp-update
index 12089bf1..c387d515 100755
--- a/bin/ncp-update
+++ b/bin/ncp-update
@@ -2,20 +2,23 @@
# 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
+{
+ 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
+ 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
+ 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
+ cd /
+ rm -rf /tmp/ncp-update-tmp
-echo -e "NextCloudPi updated to version \e[1m$VER\e[0m"
+ echo -e "NextCloudPi updated to version \e[1m$VER\e[0m"
+ exit
+} # force to read the whole thing into memory, as its contents might change in update.sh
diff --git a/nextcloud.sh b/nextcloud.sh
index 46059c6f..c5be3168 100755
--- a/nextcloud.sh
+++ b/nextcloud.sh
@@ -266,23 +266,26 @@ EOF
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 || exit 1
-cd /tmp/ncp-update-tmp
+{
+ 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
+ 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
+ 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
+ cd /
+ rm -rf /tmp/ncp-update-tmp
-echo -e "NextCloudPi updated to version \e[1m$VER\e[0m"
+ echo -e "NextCloudPi updated to version \e[1m$VER\e[0m"
+ exit
+}
EOF
chmod a+x /usr/local/bin/ncp-update