mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
28 lines
876 B
Bash
Executable File
28 lines
876 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# update latest NextCloudPi code from github
|
|
|
|
{
|
|
[ $(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 --depth 20 -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 $VER"
|
|
exit
|
|
} # force to read the whole thing into memory, as its contents might change in update.sh
|