Skip to content

Commit

Permalink
ncp-web: check for updates upon first run
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho committed Apr 4, 2018
1 parent 88e965c commit e0e9455
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 12 deletions.
2 changes: 0 additions & 2 deletions bin/ncp-check-version
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {
Expand Down
4 changes: 3 additions & 1 deletion bin/ncp-test-updates
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
4 changes: 0 additions & 4 deletions bin/nextcloudpi-config
Original file line number Diff line number Diff line change
Expand Up @@ -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 && \
Expand Down
4 changes: 1 addition & 3 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
2 changes: 1 addition & 1 deletion etc/nextcloudpi-config.d/nc-swapfile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion ncp-web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -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>';
Expand Down
3 changes: 3 additions & 0 deletions nextcloudpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e0e9455

Please sign in to comment.