-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wineextradeps.sh
39 lines (28 loc) · 1.01 KB
/
wineextradeps.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
#!/usr/bin/env bash
get_hrefs () {
local url="$1"
local regexp="$2"
wget -q -O- "${url}" | sed -E "s/></>\n</g" | sed -n -E "s|^.*<a href=\"(${regexp})\">.*|\1|p" | uniq
}
get_app_ver () {
local app="${1^^}"
local url="https://raw.githubusercontent.com/wine-mirror/wine/wine-${WINE_VER}/dlls/appwiz.cpl/addons.c"
wget -q -O- "${url}" | grep -E "^#define ${app}_VERSION\s" | awk -F\" '{print $2}'
}
WINE_VER="$1"
if [ -z "${WINE_VER}" ]; then
echo "Please specify the version of wine that requires gecko and mono installers"
echo "e.g."
echo " $0 5.0.1"
exit 1
fi
for APP in "gecko" "mono"; do
APP_VER=$(get_app_ver "${APP}")
APP_URL="http://dl.winehq.org/wine/wine-${APP}/${APP_VER}/"
mapfile -t FILES < <(get_hrefs "${APP_URL}" ".*\.msi")
[ ! -d "/usr/share/wine/${APP}" ] && mkdir -p "/usr/share/wine/${APP}"
for FILE in "${FILES[@]}"; do
echo "Downloading '${FILE}'"
wget -nv -O "/usr/share/wine/${APP}/${FILE}" "${APP_URL}${FILE}"
done
done