From 3bf32738dff35317b1d0aaa6cc08eebbc51fab0b Mon Sep 17 00:00:00 2001 From: Maxim Slipenko Date: Mon, 18 Sep 2023 06:32:44 +0000 Subject: [PATCH] wip --- src/wine/install.sh | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/wine/install.sh b/src/wine/install.sh index 731d20b..97cfef3 100644 --- a/src/wine/install.sh +++ b/src/wine/install.sh @@ -1,8 +1,24 @@ -#!/bin/sh +#!/bin/bash set -e WINEVERSION="${VERSION:-"latest"}" +WINEHOME=$_REMOTE_USER_HOME +WINEPREFIX="$WINEHOME/.wine32" +WINEARCH="win32" +WINEDEBUG="-all" + +update_rc_file() { + # see if folder containing file exists + local rc_file_folder + rc_file_folder="$(dirname "$1")" + if [ ! -d "${rc_file_folder}" ]; then + echo "${rc_file_folder} does not exist. Skipping update of $1." + elif [ ! -e "$1" ] || [[ "$(cat "$1")" != *"$2"* ]]; then + echo "$2" >>"$1" + fi +} + install_debian() { export DEBIAN_FRONTEND=noninteractive dpkg --add-architecture i386 @@ -32,7 +48,21 @@ install_debian() { wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks -O /usr/bin/winetricks chmod +rx /usr/bin/winetricks - su -l "$_REMOTE_USER" -c "WINEPREFIX=\"$_REMOTE_USER_HOME\" wine wineboot --init" + mkdir -p "$WINEPREFIX" + + snippet=" + WINEHOME=\"$_REMOTE_USER_HOME\" + WINEPREFIX=\"\$WINEHOME/.wine32\" + WINEARCH=win32 + WINEDEBUG=-all + " + + update_rc_file "$_REMOTE_USER_HOME/.zshenv" "${snippet}" + update_rc_file "$_REMOTE_USER_HOME/.profile" "${snippet}" + update_rc_file "$_REMOTE_USER_HOME/.bashrc" "${snippet}" + + su -l "$_REMOTE_USER" -c "mkdir -p $WINEPREFIX" + su -l "$_REMOTE_USER" -c "wine wineboot --init" # Cleanup apt purge --auto-remove -y