check version format

This commit is contained in:
nachoparker 2017-06-13 11:17:13 +02:00
parent 338adfb1e3
commit ecedf91306
4 changed files with 22 additions and 13 deletions

View File

@ -6,10 +6,13 @@
ping -W 2 -w 1 -q github.com &>/dev/null || { echo "No internet connectivity"; exit 1; }
git clone -q --depth 1 https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp || exit 1
git clone -q --bare https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp || exit 1
cd /tmp/ncp-check-tmp
git describe --always --tags > /var/run/.ncp-latest-version
VER=$( git describe --always --tags | grep -oP "v\d+\.\d+\.\d+" )
grep -qP "v\d+\.\d+\.\d+" <<< $VER && { # check format
echo $VER > /var/run/.ncp-latest-version
}
cd /
rm -rf /tmp/ncp-check-tmp

View File

@ -7,15 +7,17 @@
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/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp || exit 1
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 )
echo $VER > /usr/local/etc/ncp-version
echo $VER > /var/run/.ncp-latest-version
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

View File

@ -96,15 +96,17 @@ cat > /usr/local/bin/ncp-update <<'EOF'
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/nextcloud/nextcloudpi.git /tmp/ncp-update-tmp || exit 1
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 )
echo $VER > /usr/local/etc/ncp-version
echo $VER > /var/run/.ncp-latest-version
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

View File

@ -26,9 +26,11 @@ install()
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 | 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