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>2018-04-04 15:21:10 +0300
committernachoparker <nacho@ownyourbits.com>2018-04-04 20:32:07 +0300
commit16e245cf697a88917d07fc0f72af4d27edc1e34b (patch)
tree2c5b40065e7cd31fd9905ad8e65b290dedb3cc15
parent8a2d30a6b2cf335098391b6ccf985b14cafd1fee (diff)
ncp-web: check for updates upon first runv0.53.20
-rwxr-xr-xbin/ncp-check-version2
-rwxr-xr-xbin/ncp-test-updates4
-rwxr-xr-xbin/nextcloudpi-config4
-rw-r--r--changelog.md4
-rw-r--r--etc/nextcloudpi-config.d/nc-swapfile.sh2
-rw-r--r--ncp-web/index.php2
-rw-r--r--nextcloudpi.sh3
7 files changed, 9 insertions, 12 deletions
diff --git a/bin/ncp-check-version b/bin/ncp-check-version
index a7281f4c..97182f4c 100755
--- a/bin/ncp-check-version
+++ b/bin/ncp-check-version
@@ -2,8 +2,6 @@
# update latest available version in /var/run/.ncp-latest-version
-[ $(id -u) -ne 0 ] && exit 1
-
rm -rf /tmp/ncp-check-tmp
git clone --depth 20 -q --bare https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp || {
diff --git a/bin/ncp-test-updates b/bin/ncp-test-updates
index 1a362401..e439a55e 100755
--- a/bin/ncp-test-updates
+++ b/bin/ncp-test-updates
@@ -5,7 +5,9 @@
NEED_UPDATE=false
VERFILE=/var/run/.ncp-latest-version
-if test -f $VERFILE && grep -qP "v\d+\.\d+\.\d+" $VERFILE; then
+[[ $( cat $VERFILE | wc -c ) -eq 0 ]] && ncp-check-version
+
+if grep -qP "v\d+\.\d+\.\d+" $VERFILE; then
MAJOR=$( grep -oP "\d+\.\d+\.\d+" $VERFILE | cut -d. -f1 )
MINOR=$( grep -oP "\d+\.\d+\.\d+" $VERFILE | cut -d. -f2 )
diff --git a/bin/nextcloudpi-config b/bin/nextcloudpi-config
index 781f4ea2..9be1aeaf 100755
--- a/bin/nextcloudpi-config
+++ b/bin/nextcloudpi-config
@@ -22,11 +22,7 @@ function nextcloud-config()
local CONFDIR=/usr/local/etc/nextcloudpi-config.d/
local DESC
- # save latest version if it has never done before
- test -f $VERFILE || ncp-check-version
-
# ask for update if outdated
-
test -f /usr/local/etc/ncp-changelog && \
local CHANGELOG=$( head -4 /usr/local/etc/ncp-changelog )
ncp-test-updates && \
diff --git a/changelog.md b/changelog.md
index 6be44ab0..735fc062 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,7 +1,5 @@
-[v0.53.20](https://github.com/nextcloud/nextcloudpi/commit/b0fbe28) (2018-04-04) ncp-web: replace textarea with div for output
-
-[v0.53.19](https://github.com/nextcloud/nextcloudpi/commit/b92ba98) (2018-04-04) ncp-web: check for updates upon first run
+[v0.53.19](https://github.com/nextcloud/nextcloudpi/commit/18d1dd4) (2018-04-04) ncp-web: check for updates upon first run
[v0.53.18](https://github.com/nextcloud/nextcloudpi/commit/e7b76b6) (2018-04-04) ncp-web: refresh sidebar after launching actions
diff --git a/etc/nextcloudpi-config.d/nc-swapfile.sh b/etc/nextcloudpi-config.d/nc-swapfile.sh
index 4dfd2212..6f435c06 100644
--- a/etc/nextcloudpi-config.d/nc-swapfile.sh
+++ b/etc/nextcloudpi-config.d/nc-swapfile.sh
@@ -21,7 +21,7 @@ DESCRIPTION="Move and resize your swapfile. Recommended to move to a permanent U
is_active()
{
local DIR=$( swapon -s | sed -n 2p | awk '{ print $1 }' )
- [[ "$DIR" != "/var/swap" ]]
+ [[ "$DIR" != "" ]] && [[ "$DIR" != "/var/swap" ]]
}
configure()
diff --git a/ncp-web/index.php b/ncp-web/index.php
index bee9bce4..0f6f1451 100644
--- a/ncp-web/index.php
+++ b/ncp-web/index.php
@@ -71,7 +71,7 @@
if ($ret == 0) {
echo '<div id="notification">';
echo '<div id="update-notification" class="row type-error closeable">';
- echo "version " . file_get_contents( "/var/run/.ncp-latest-version" ) . " is available";
+ echo "version " . file_get_contents( '/var/run/.ncp-latest-version' ) . " is available";
echo '<a class="action close icon-close" href="#" alt="Dismiss"></a>';
echo '</div>';
echo '</div>';
diff --git a/nextcloudpi.sh b/nextcloudpi.sh
index 75a66a9f..0727d368 100644
--- a/nextcloudpi.sh
+++ b/nextcloudpi.sh
@@ -174,6 +174,9 @@ EOF
/usr/local/bin/ncp-check-version
EOF
chmod a+x /etc/cron.daily/ncp-check-version
+ touch /var/run/.ncp-latest-version
+ chown root:www-data /var/run/.ncp-latest-version
+ chmod g+w /var/run/.ncp-latest-version
# TMP UPLOAD DIR
mkdir -p "$UPLOADTMPDIR"