Skip to content
Snippets Groups Projects
Commit 0e550354 authored by David Verelst's avatar David Verelst
Browse files

fixed and refactored wine configuration script

parent 0f6b37c0
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
if [ "$1" = "" ] ; then
WINEDIRNAME=".wine32"
else
WINEDIRNAME="$1"
function wine_init_config(){
# winefix only applies to Jess
if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then
`$WINE_ENV_VARS` winefix
fi
# try to execute a non existant executable to trigger init configuration
`$WINE_ENV_VARS` wine dummy
# create a directory on the user home drive in which executables are placed
EXE_DIR_UNIX="/home/$USER/wine_exe/$WINEARCH/"
mkdir -p $EXE_DIR_UNIX
echo "-------- copying HAWC2 executables from/to:"
echo "$HAWC2EXES/* $EXE_DIR_UNIX"
cp $HAWC2EXES/* "$EXE_DIR_UNIX"
# add C:\bin (/home/$USER/$WINEDIRNAME/drive_c/bin/) to Windows PATH variable
EXE_DIR_WINE="c:/users/$USER/My Documents/wine_exe/$WINEARCH/"
echo "-------- adding $EXE_DIR_UNIX to wine system PATH"
echo "-------- this is equivalent to $EXE_DIR_WINE in Windows terms."
echo
# create file with registry key name and path as the value
printf 'REGEDIT4\n[HKEY_CURRENT_USER\\Environment]\n"PATH"="'"$EXE_DIR_WINE"'"' >> ./tmp.reg
$WINE_ENV_VARS wine regedit ./tmp.reg
# do not show GUI crash dialogs
rm ./tmp.reg
printf '[HKEY_CURRENT_USER\\Software\\Wine\\WineDbg]\n"ShowCrashDialog"=dword:00000000' >> ./tmp.reg
$WINE_ENV_VARS wine regedit ./tmp.reg
rm ./tmp.reg
# add an alias to .bashrc, but only for the 32-bit variant
if [[ ${_HOSTNAME_:0:1} == "g" ]] ; then
echo "-------- adding alias $WINE_ALIAS to ~/.bashrc"
echo "alias $WINE_ALIAS='$WINE_ENV_VARS wine'" >> ~/.bashrc
source ~/.bashrc
echo "-------- See if HAWC2 runs..."
$WINE_ENV_VARS wine hawc2-latest.exe
}
_HOSTNAME_=`hostname`
# default 64-bit mode only relevant on Jess
if [[ ${_HOSTNAME_:0:1} == "j" ]] ; then
echo "-------- SETUP DEFAULT 64-bit wine environment in ~/.wine"
WINEARCH="win64"
WINEDIRNAME="/home/$USER/.wine"
WINE_ENV_VARS="WINEPREFIX=$WINEDIRNAME"
WINE_ALIAS="wine"
HAWC2EXES=/home/MET/hawc2exe/$WINEARCH
wine_init_config
fi
HAWC2EXES=/home/MET/hawc2exe
WINEARCH=win32 WINEPREFIX=~/$WINEDIRNAME wine dummy
mkdir -p "/home/$USER/$WINEDIRNAME/drive_c/bin/"
echo "-------- copying HAWC2 executables from/to:"
echo "$HAWC2EXES/* /home/$USER/$WINEDIRNAME/drive_c/bin/"
cp $HAWC2EXES/* "/home/$USER/$WINEDIRNAME/drive_c/bin/"
#WINEARCH=win32 WINEPREFIX=~/$WINEDIRNAME wine regedit /E tmp.reg "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment"
#sed -i 's/"PATH"="C:\\\\windows\\\\system32;C:\\\\windows"/"PATH"="C:\\\\windows\\\\system32;C:\\\\windows;C:\\\\bin"/g' tmp.reg
#WINEARCH=win32 WINEPREFIX=~/$WINEDIRNAME wine regedit ./tmp.reg
#rm ./tmp.reg
# add C:\bin (/home/$USER/$WINEDIRNAME/drive_c/bin/) to Windows PATH variable
echo "-------- adding /home/$USER/$WINEDIRNAME/drive_c/bin/ to wine system PATH"
echo "-------- this is equivalent to C:\bin in Windows terms."
# seems like this doesn't work since the key Environment doesn't exist by default?
#rm ./tmp.reg
#WINEARCH=win32 WINEPREFIX=~/$WINEDIRNAME wine regedit /E ./tmp.reg "HKEY_CURRENT_USER\Environment"
#printf '"PATH"="c:\\bin"' >> ./tmp.reg
printf 'REGEDIT4\n[HKEY_CURRENT_USER\\Environment]\n"PATH"="c:\\bin"' >> ./tmp.reg
WINEARCH=win32 WINEPREFIX=~/$WINEDIRNAME wine regedit ./tmp.reg
# do not show GUI crash dialogs
rm ./tmp.reg
printf '[HKEY_CURRENT_USER\\Software\\Wine\\WineDbg]\n"ShowCrashDialog"=dword:00000000' >> ./tmp.reg
WINEARCH=win32 WINEPREFIX=~/$WINEDIRNAME wine regedit ./tmp.reg
rm ./tmp.reg
# add an alias to .bashrc
echo "-------- adding alias wine32 to ~/.bashrc"
echo "alias wine32='WINEARCH=win32 WINEPREFIX=~/$WINEDIRNAME wine'" >> ~/.bashrc
source ~/.bashrc
echo "-------- See if HAWC2 runs..."
WINEARCH=win32 WINEPREFIX=~/$WINEDIRNAME wine hawc2-123-beta.exe
# 32-bit mode for both Gorm and Jess
echo "-------- SETUP 32-bit wine environment in ~/.wine32"
WINEARCH="win32"
WINEDIRNAME="/home/$USER/.wine32-clean"
WINE_ENV_VARS="WINEARCH=$WINEARCH WINEPREFIX=$WINEDIRNAME"
export WINEARCH=$WINEARCH
export WINEPREFIX=$WINEDIRNAME
WINE_ALIAS="wine32"
HAWC2EXES=/home/MET/hawc2exe/$WINEARCH
wine_init_config
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment