Skip to content

Commit

Permalink
faster remote updates and version checks
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho committed Aug 15, 2017
1 parent fb1fb9e commit 1e540ec
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 32 deletions.
2 changes: 1 addition & 1 deletion bin/ncp-check-version
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

ping -W 2 -w 1 -q github.com &>/dev/null || { echo "No internet connectivity"; exit 1; }

git clone -q --bare https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp || exit 1
git clone --depth 20 -q --bare https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp || exit 1

cd /tmp/ncp-check-tmp
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp-update
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
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 https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp || exit 1
git clone --depth 20 -q https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp || exit 1
cd /tmp/ncp-update-tmp

echo -e "Performing updates"
Expand Down
2 changes: 1 addition & 1 deletion build-devel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ install()
{
echo -e "Downloading updates"
rm -rf /tmp/ncp-update-tmp
git clone -q -b devel https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp
git clone --depth 20 -q -b devel https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp
cd /tmp/ncp-update-tmp

echo -e "Performing updates"
Expand Down
31 changes: 2 additions & 29 deletions nextcloudpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,42 +124,15 @@ EOF
EOF
chmod a+x /etc/cron.daily/ncp-check-version


cat > /usr/local/bin/ncp-update <<'EOF'
#!/bin/bash
{
[ $(id -u) -ne 0 ] && { printf "Must be run as root. Try 'sudo $0'\n"; exit 1; }
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 https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp || exit 1
cd /tmp/ncp-update-tmp
echo -e "Performing updates"
./update.sh
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
grep -qP "v\d+\.\d+\.\d+" <<< $VER && { # check format
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"
exit
}
EOF
chmod a+x /usr/local/bin/ncp-update

# TMP UPLOAD DIR
mkdir -p "$UPLOADTMPDIR"
chown www-data:www-data "$UPLOADTMPDIR"
sed -i "s|^;\?upload_tmp_dir =.*$|upload_tmp_dir = $UPLOADTMPDIR|" /etc/php/7.0/fpm/php.ini
sed -i "s|^;\?sys_temp_dir =.*$|sys_temp_dir = $UPLOADTMPDIR|" /etc/php/7.0/fpm/php.ini

# update to latest version from github as part of the build process
wget https://raw.githubusercontent.com/nextcloud/nextcloudpi/master/bin/ncp-update -O /usr/local/bin/ncp-update
chmod a+x /usr/local/bin/ncp-update
/usr/local/bin/ncp-update

# External requirements for Apps
Expand Down

0 comments on commit 1e540ec

Please sign in to comment.