forked from chenxiaolong/Unity-for-Arch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathversion_checker.sh
137 lines (127 loc) · 3.38 KB
/
version_checker.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
#!/bin/bash
# Do not run this manually
get_ubuntu_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
if [ -z "${2}" ]; then
echo "No Ubuntu version was provided"
exit 1
fi
if [ "x${3}" == "xnative" ]; then
wget -q -O - "https://launchpad.net/ubuntu/${2}/+source/${1}" | \
sed -n 's/^.*current\ release\ (\(.*\)).*$/\1/p'
else
wget -q -O - "https://launchpad.net/ubuntu/${2}/+source/${1}" | \
sed -n 's/^.*current\ release\ (\(.*\)-\(.*\)).*$/\1 \2/p'
fi
}
get_launchpad_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
local PACKAGE=${1}
local TARBALL=${1}
if [ ! -z "${2}" ]; then
TARBALL=${2}
fi
wget -q -O - "https://launchpad.net/${PACKAGE}/+download" | \
sed -rn "s/.*${TARBALL}[-_]+(.*)\.tar.*/\1/p" | head -n 1
}
get_pypi_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
wget -q -O - "http://pypi.python.org/pypi/${1}" | \
sed -rn "s/.*>${1}-(.*)\.(tar\.|zip).*<.*/\1/p" | head -n 1
}
get_gnome_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
if [ -z "${2}" ]; then
echo "No major version was provided"
exit 1
fi
wget -q -O - "http://ftp.gnome.org/pub/GNOME/sources/${1}/${2}/" | \
sed -rn 's/.*>LATEST-IS-(.*)<.*/\1/p'
}
get_archlinux_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
if [ -z "${2}" ]; then
echo "No repository was provided"
exit 1
fi
if [ -z "${3}" ]; then
echo "No architecture was provided"
exit 1
fi
wget -q -O - "https://www.archlinux.org/packages/${2}/${3}/${1}/" | \
sed -rn "/<title>/ s/^.*${1}\ (.*)-(.*)\ (.*)$/\1 \2/p"
}
get_xorg_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
if [ -z "${2}" ]; then
echo "No category was provided"
exit 1
fi
wget -q -O - "http://xorg.freedesktop.org/releases/individual/${2}/" |
sed -rn "s/.*${1}-(.*)\.tar.*/\1/p" | tail -n 1
}
get_ppa_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
if [ -z "${2}" ]; then
echo "No PPA was provided"
exit 1
fi
if [ "x${3}" == "xnative" ]; then
wget -q -O - \
"http://ppa.launchpad.net/${2/#ppa:/}/ubuntu/pool/main/${1:0:1}/${1}/?C=M;O=A" | \
sed -rn "s/.*>${1}_(.*)-(.*)\.tar\.[a-z\.]+<.*/\1 \2/p" | \
tail -n 1
elif [ "x${3}" == "xnorel" ]; then
wget -q -O - \
"http://ppa.launchpad.net/${2/#ppa:/}/ubuntu/pool/main/${1:0:1}/${1}/?C=M;O=A" | \
sed -rn "s/.*>${1}_(.*)\.(debian|diff)\.[a-z\.]+<.*/\1/p" | \
tail -n 1
else
wget -q -O - \
"http://ppa.launchpad.net/${2/#ppa:/}/ubuntu/pool/main/${1:0:1}/${1}/?C=M;O=A" | \
sed -rn "s/.*>${1}_(.*)-(.*)\.(debian|diff)\.[a-z\.]+<.*/\1 \2/p" | \
tail -n 1
fi
}
get_freedesktop_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
wget -q -O - "http://cgit.freedesktop.org/${1}/" | \
sed -rn "s/.*>${1}-(.*)\.tar\.gz<.*/\1/p" | head -n 1
}
get_googlecode_version() {
if [ -z "${1}" ]; then
echo "No package was provided"
exit 1
fi
local PACKAGE=${1}
local TARBALL=${1}
if [ ! -z "${2}" ]; then
TARBALL=${2}
fi
wget -q -O - "https://code.google.com/p/${PACKAGE}/downloads/list" | \
sed -rn "s/.*${TARBALL}-(.*)\.(tar\.|zip).*/\1/p" | head -n 1
}