forked from Dh0mp5eur/TeamSpeak3-Client
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpackage.sh
executable file
·40 lines (35 loc) · 1015 Bytes
/
package.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
arch=$(uname -m)
if [ "$arch" == "x86_64" ]; then
arch="amd64"
else
arch="x86"
fi
old_version=$(
cat ./$arch/DEBIAN/control |
grep -oP '[0-9]+\.[0-9]+\.[0-9](-[0-9])?'
)
new_version=$(
curl -s "https://teamspeak.com/en/your-download/#ts3client" |
awk -F'href=' 'NF>1 && $2~/\.(run)/ {split($2,a,"\"");print a[2]}' |
tr -d '\n' | sed "s|#||g" | grep -oP '[0-9]+\.[0-9]+\.[0-9](-[0-9])?' |
head -n 1
)
files=(
"preinst"
"control"
)
if [[ "$old_version" < ${new_version} ]]
then
for f in "${files[@]}"; do
sed -i "s|$old_version|$new_version|g" ./$arch/DEBIAN/"$f"
done
dpkg-deb --build $arch "teamspeak3-client_$arch-$new_version.deb"
git add -A
git commit -m "Update TeamSpeak3-Client version from $old_version to $new_version"
git push -u origin master
git tag -a "${new_version}" -m "Update TeamSpeak3-Client version from $old_version to $new_version"
git push --tags origin master
else
echo "Latest TeamSpeak3 version already installed ($old_version)"
fi