This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb31bd7
commit b3b579b
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Scrapes the Wine source code for versions of mono and gecko to download for a given version of Wine | ||
|
||
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^^}" # Convert to uppercase | ||
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 | ||
|
||
# Get the pkg version required from wine source code | ||
APP_VER=$(get_app_ver "${APP}") | ||
|
||
# Get the list of files to download | ||
APP_URL="http://dl.winehq.org/wine/wine-${APP}/${APP_VER}/" | ||
mapfile -t FILES < <(get_hrefs "${APP_URL}" ".*\.msi") | ||
|
||
# Download the files | ||
[ ! -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 |