Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Install wine and winetricks
Browse files Browse the repository at this point in the history
  • Loading branch information
wanjohiryan committed Jun 24, 2023
1 parent cb31bd7 commit b3b579b
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docker/nvidia/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ RUN locale-gen en_US.UTF-8;\
ln -s /usr/games/steamcmd /usr/bin/steamcmd;\
steamcmd +quit

#
#Install wine
ARG WINE_BRANCH="staging"
RUN wget -nv -O- https://dl.winehq.org/wine-builds/winehq.key | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add - \
&& apt-add-repository "deb https://dl.winehq.org/wine-builds/ubuntu/ $(grep VERSION_CODENAME= /etc/os-release | cut -d= -f2) main" \
&& dpkg --add-architecture i386 \
&& apt-get update \
&& DEBIAN_FRONTEND="noninteractive" apt-get install -y --install-recommends winehq-${WINE_BRANCH} \
&& rm -rf /var/lib/apt/lists/*

#
#Install gecko and mono installers
COPY docker/nvidia/download_gecko_and_mono.sh /root/download_gecko_and_mono.sh
RUN chmod +x /root/download_gecko_and_mono.sh \
&& /root/download_gecko_and_mono.sh "$(dpkg -s wine-${WINE_BRANCH} | grep "^Version:\s" | awk '{print $2}' | sed -E 's/~.*$//')"

#
# Install winetricks
RUN wget -nv -O /usr/bin/winetricks https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks \
&& chmod +x /usr/bin/winetricks

#
# NVIDIA Container Toolkit & Docker
RUN distribution=$(. /etc/os-release;echo $ID$VERSION_ID); \
Expand Down
44 changes: 44 additions & 0 deletions docker/nvidia/download_gecko_and_mono.sh
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

0 comments on commit b3b579b

Please sign in to comment.