blob: 97182f4cdfa312f6e4cf125d514987cd20d198f2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#!/bin/bash
# update latest available version in /var/run/.ncp-latest-version
rm -rf /tmp/ncp-check-tmp
git clone --depth 20 -q --bare https://github.com/nextcloud/nextcloudpi.git /tmp/ncp-check-tmp || {
echo "The git clone command failed: No connectivity to https://github.com ?"
exit 1
}
cd /tmp/ncp-check-tmp || exit 1
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
# write changelog
git log --graph --oneline --decorate \
--pretty=format:"[%D] %s" --date=short | \
grep 'tag: v' | \
sed '/HEAD ->\|origin/s|\[.*\(tag: v[0-9]\+\.[0-9]\+\.[0-9]\+\).*\]|[\1]|' | \
sed 's|* \[tag: |[|' > /usr/local/etc/ncp-changelog
}
cd / || exit 1
rm -rf /tmp/ncp-check-tmp
|