blob: a7281f4cd86f94dcf94051f2f09f8c7b91f7936d (
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
27
28
|
#!/bin/bash
# update latest available version in /var/run/.ncp-latest-version
[ $(id -u) -ne 0 ] && exit 1
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
|