-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck.sh
executable file
·139 lines (118 loc) · 5.87 KB
/
check.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#!/usr/bin/env bash
# Detect absolute and full path as well as filename of this script
cd "$(dirname "$0")" || exit
CURRDIR=$(pwd)
cd - > /dev/null || exit
GitHubDesktop() {
github_dektop_repo=shiftkey/desktop
cd "${CURRDIR}" || exit
github_desktop_CUR_VERSION="$(find ./debian/ -name "GitHubDesktop-linux-*.deb" | sed 's/.*-\([0-9\.][0-9\.]*\).*/\1/' | sort -rnk3 | head -n 1)"
github_desktop_NEW_VERSION="$(curl -sSL https://api.github.com/repos/$github_dektop_repo/releases | grep '"tag_name":' | sed -n 's/[^0-9.]*\([0-9.]*\).*/\1/p' | head -n 1)"
echo "Current GitHub Desktop Version: $github_desktop_CUR_VERSION => New Version: $github_desktop_NEW_VERSION"
if [[ "$github_desktop_CUR_VERSION" < "$github_desktop_NEW_VERSION" ]]; then
echo "Downloading new github-desktop version $github_desktop_NEW_VERSION" | mail -s "Downloading new github-desktop version $github_desktop_NEW_VERSION" $email
cd "${CURRDIR}" || exit
curl -sSL https://api.github.com/repos/$github_dektop_repo/releases \
| grep "browser_download_url.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
| head -n 1 \
| wget -qi -
deb_file="$(find . -name "GitHubDesktop-linux*-$github_desktop_NEW_VERSION-linux*.deb" 2>/dev/null)"
mv "$deb_file" ./debian/
. ./update.sh
git add -A
git commit -m "Update github-desktop version to $github_desktop_NEW_VERSION"
git push -u origin master
git tag -a "$github_desktop_NEW_VERSION" -m "Update github-desktop version from $github_desktop_CUR_VERSION to $github_desktop_NEW_VERSION"
git push --tags origin master
exit
else
echo "Latest GitHub Desktop version already installed"
fi
}
gnuzilla() {
ICECATE_URL=https://download.opensuse.org/repositories/home:/losuler:/icecat/Debian_11/amd64
cd "${CURRDIR}" || exit
ICECAT_CUR_VERSION="$(find ./debian/ -name "icecat_*.deb" | cut -d _ -f 2 | sort -rnk3 | head -n 1)"
ICECAT_NEW_VERSION="$(curl -sSL $ICECATE_URL | grep -oP 'href="icecat_\K[0-9]+\.[0-9]+\.[0-9](-[0-9])?' | sort -rnk3 | head -n 1)"
echo "Current Icecat Version: $ICECAT_CUR_VERSION => New Version: $ICECAT_NEW_VERSION"
if [[ "$ICECAT_CUR_VERSION" < ${ICECAT_NEW_VERSION} ]]; then
echo "Downloading new Icecat version $ICECAT_NEW_VERSION" | mail -s "Downloading new Icecat version $ICECAT_NEW_VERSION" $email
cd "${CURRDIR}" || exit
wget $ICECATE_URL/icecat_"${ICECAT_NEW_VERSION}"_amd64.deb
deb_file="$(find . -name "icecat_${ICECAT_NEW_VERSION}_amd64.deb" 2>/dev/null)"
mv "$deb_file" ./debian/
. ./update.sh
git add -A
git commit -m "Update Icecat version to $ICECAT_NEW_VERSION"
git push -u origin master
git tag -a "${ICECAT_NEW_VERSION}" -m "Update Icecat version from $ICECAT_CUR_VERSION to $ICECAT_NEW_VERSION"
git push --tags origin master
exit
else
echo "Latest Icecat version already installed"
fi
}
snapserver() {
snapserver_repo=badaix/snapcast
cd "${CURRDIR}" || exit
snapserver_CUR_VERSION="$(find . -name "snapserver_*.deb" | sed 's/.*_\([0-9\.][0-9\.]*\).*/\1/' | sort -rnk3 | head -n 1)"
snapserver_NEW_VERSION="$(curl -sSL https://api.github.com/repos/$snapserver_repo/releases | grep '"tag_name":' | sed -n 's/[^0-9.]*\([0-9.]*\).*/\1/p' | head -n 1)"
echo "Current snapserver Version: $snapserver_CUR_VERSION => New Version: $snapserver_NEW_VERSION"
if [[ "$snapserver_CUR_VERSION" < "$snapserver_NEW_VERSION" ]]; then
echo "Downloading new snapserver version $snapserver_NEW_VERSION" | mail -s "Downloading new snapserver version $snapserver_NEW_VERSION" $email
cd "${CURRDIR}" || exit
curl -sSL https://api.github.com/repos/$snapserver_repo/releases \
| grep "browser_download_url.*snapserver.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
| head -n 1 \
| wget -qi -
deb_file="$(find . -name "snapserver_$snapserver_NEW_VERSION-1_amd64_$(lsb_release -sc).deb" 2>/dev/null)"
#deb_file="$(find . -name "snapserver_\"$snapserver_NEW_VERSION\"_amd64_\"$(lsb_release -sc)\".deb" 2>/dev/null)"
mv "$deb_file" ./debian/
. ./update.sh
git add -A
git commit -m "Update snapserver version to $snapserver_NEW_VERSION"
git push -u origin master
git tag -a "$snapserver_NEW_VERSION" -m "Update snapserver version from $snapserver_CUR_VERSION to $snapserver_NEW_VERSION"
git push --tags origin master
exit
else
echo "Latest snapserver version already downloaded..."
fi
}
snapclient() {
snapclient_repo=badaix/snapcast
cd "${CURRDIR}" || exit
snapclient_CUR_VERSION="$(find . -name "snapclient_*.deb" | sed 's/.*_\([0-9\.][0-9\.]*\).*/\1/' | sort -rnk3 | head -n 1)"
snapclient_NEW_VERSION="$(curl -sSL https://api.github.com/repos/$snapclient_repo/releases | grep '"tag_name":' | sed -n 's/[^0-9.]*\([0-9.]*\).*/\1/p' | head -n 1)"
echo "Current snapclient Version: $snapclient_CUR_VERSION => New Version: $snapclient_NEW_VERSION"
if [[ "$snapclient_CUR_VERSION" < "$snapclient_NEW_VERSION" ]]; then
echo "Downloading new snapclient version $snapclient_NEW_VERSION" | mail -s "Downloading new snapclient version $snapclient_NEW_VERSION" $email
cd "${CURRDIR}" || exit
curl -sSL https://api.github.com/repos/$snapclient_repo/releases \
| grep "browser_download_url.*snapclient.*deb" \
| cut -d : -f 2,3 \
| tr -d \" \
| head -n 1 \
| wget -qi -
deb_file="$(find . -name "snapclient_$snapclient_NEW_VERSION-1_amd64_$(lsb_release -sc).deb" 2>/dev/null)"
mv "$deb_file" ./debian/
. ./update.sh
git add -A
git commit -m "Update snapclient version to $snapclient_NEW_VERSION"
git push -u origin master
git tag -a "$snapclient_NEW_VERSION" -m "Update snapclient version from $snapclient_CUR_VERSION to $snapclient_NEW_VERSION"
git push --tags origin master
exit
else
echo "Latest snapclient version already downloaded..."
fi
}
#GitHubDesktop
gnuzilla
snapserver
snapclient