Skip to content

Commit

Permalink
check version format
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Jun 28, 2017
1 parent 338adfb commit ecedf91
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
7 changes: 5 additions & 2 deletions bin/ncp-check-version
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 6 additions & 4 deletions bin/ncp-update
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions nextcloudpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions test-devel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ecedf91

Please sign in to comment.