From ae7a5e3fa63d2c43bdd671cfaeee4062655368e6 Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Fri, 19 Apr 2024 16:32:09 +0000 Subject: [PATCH] add ubuntu support --- .github/workflows/test.yaml | 1 + src/wine/install.sh | 47 +++++++++++++++++++++++-------------- 2 files changed, 31 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b9397eb..2767fcb 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -16,6 +16,7 @@ jobs: - wine baseImage: - mcr.microsoft.com/devcontainers/base:debian + - mcr.microsoft.com/devcontainers/base:ubuntu steps: - uses: actions/checkout@v3 diff --git a/src/wine/install.sh b/src/wine/install.sh index 9571e57..c58d094 100644 --- a/src/wine/install.sh +++ b/src/wine/install.sh @@ -36,21 +36,12 @@ update_rc_file() { fi } -install_debian() { - export DEBIAN_FRONTEND=noninteractive - dpkg --add-architecture i386 - apt-get update - apt-get install -y --no-install-recommends \ - apt-transport-https \ - ca-certificates \ - telnet \ - cabextract \ - gnupg2 \ - wget - - wget https://dl.winehq.org/wine-builds/winehq.key -O - | apt-key add - - echo "deb https://dl.winehq.org/wine-builds/debian $VERSION_CODENAME main" >/etc/apt/sources.list.d/winehq.list +add_wine_repo() { + wget -nv https://dl.winehq.org/wine-builds/winehq.key -O- | apt-key add - + echo "deb https://dl.winehq.org/wine-builds/$1 $VERSION_CODENAME main" >/etc/apt/sources.list.d/winehq.list +} +set_wine_version_preference() { if [ "${WINEVERSION}" != "latest" ]; then { echo "Package: *wine* *wine*:i386" @@ -58,11 +49,13 @@ install_debian() { echo "Pin-Priority: 1001" } >/etc/apt/preferences.d/winehq.pref fi +} +install_wine() { apt-get update apt-get install -y --install-recommends winehq-staging - wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -O /usr/bin/winetricks + wget -nv https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -O /usr/bin/winetricks chmod +rx /usr/bin/winetricks snippet="export WINEHOME=\"$_REMOTE_USER_HOME\" @@ -79,7 +72,7 @@ export WINEDEBUG=-all" wine wineboot --init mkdir -p "$COREFONTS_CACHE_DIR" for filename in ${COREFONTS_FILES[@]}; do - wget -P "$COREFONTS_CACHE_DIR" "$COREFONTS_BASE_URL\$filename" + wget -nv -P "$COREFONTS_CACHE_DIR" "$COREFONTS_BASE_URL\$filename" done winetricks corefonts EOF @@ -92,7 +85,27 @@ EOF . /etc/os-release -if [ "${ID}" = "debian" ]; then +if [ "${ID}" = "ubuntu" ]; then + install_ubuntu() { + export DEBIAN_FRONTEND=noninteractive + dpkg --add-architecture i386 + apt-get update + apt-get install -y apt-transport-https ca-certificates telnet cabextract gnupg2 wget + add_wine_repo "ubuntu" + set_wine_version_preference + install_wine + } + install_ubuntu +elif [ "${ID}" = "debian" ] || [ "${ID_LIKE}" = "debian" ]; then + install_debian() { + export DEBIAN_FRONTEND=noninteractive + dpkg --add-architecture i386 + apt-get update + apt-get install -y apt-transport-https ca-certificates telnet cabextract gnupg2 wget + add_wine_repo "debian" + set_wine_version_preference + install_wine + } install_debian else echo "Linux distro ${ID} not supported."