1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 01:24:11 +01:00

Setup script: improvements to error handling (#65)

* Setup script: improvements to error handlings

* Setup script: added missing `-e` to echo

* Setup script: fix misplaced fullstop due to windows \r
This commit is contained in:
Raffarti 2018-02-12 08:07:24 +01:00 committed by Philip Rebohle
parent 8f134bafcf
commit cb92d9954c

View File

@ -72,36 +72,48 @@ else
fi fi
fi fi
unix_sys_path="$($wine winepath -u 'C:\windows\system32')" unix_sys_path="$($wine winepath -u 'C:\windows\system32')"
if [ $? -ne 0 ]; then
exit 1
fi
ret=0 ret=0
function removeOverride { function removeOverride {
echo -n ' [1/2] Removing override... ' echo -n ' [1/2] Removing override... '
wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d builtin /f local out
if [ ! $? ]; then out=$(wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d builtin /f 2>&1)
if [ $? -ne 0 ]; then
echo -e "\\e[1;31m$out\\e[0m"
exit 1 exit 1
fi fi
echo -e "$(sed -e 's|\r||g' <<< "\\e[1;32m$out\\e[0m.")"
local dll="$unix_sys_path/$1.dll" local dll="$unix_sys_path/$1.dll"
echo -n ' [2/2] Removing link... ' echo -n ' [2/2] Removing link... '
if [ -h "$dll" ]; then if [ -h "$dll" ]; then
rm "$dll" out=$(rm "$dll" 2>&1)
if [ "$?" == "0" ]; then if [ $? -eq 0 ]; then
echo "Done." echo -e '\e[1;32mDone\e[0m.'
else else
ret=2 ret=2
echo -e "\\e[1;31m$out\\e[0m"
fi fi
else else
echo "'$dll' is not a link or doesn't exist." echo -e "\\e[1;33m'$dll' is not a link or doesn't exist\\e[0m."
ret=2 ret=2
fi fi
} }
function checkOverride { function checkOverride {
echo -n ' [1/2] Checking override... ' echo -n ' [1/2] Checking override... '
local ovr="$(wine reg query 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1)" echo -en '\e[1;31m'
if [ ! $? ]; then local ovr
ovr="$(wine reg query 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1)"
if [ $? -ne 0 ]; then
echo -en '\e[1;0m'
exit 1 exit 1
fi fi
echo -en '\e[1;0m'
if [[ $ovr == *native* ]] && ! [[ $ovr == *builtin,native* ]]; then if [[ $ovr == *native* ]] && ! [[ $ovr == *builtin,native* ]]; then
echo -e '\e[1;32mOK\e[0m.' echo -e '\e[1;32mOK\e[0m.'
else else
@ -119,16 +131,20 @@ function checkOverride {
function createOverride { function createOverride {
echo -n ' [1/2] Creating override... ' echo -n ' [1/2] Creating override... '
wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d native /f local out
if [ ! $? ]; then out=$(wine reg add 'HKEY_CURRENT_USER\Software\Wine\DllOverrides' /v $1 /d native /f 2>&1)
if [ $? -ne 0 ]; then
echo -e "\\e[1;31m$out\\e[0m"
exit 1 exit 1
fi fi
echo -e "$(sed -e 's|\r||g' <<< "\\e[1;32m$out\\e[0m.")"
echo -n " [2/2] Creating link to $1.dll... " echo -n " [2/2] Creating link to $1.dll... "
ln -sf "$dlls_dir/$1.dll" "$unix_sys_path/$1.dll" ln -sf "$dlls_dir/$1.dll" "$unix_sys_path/$1.dll"
if [ $? ]; then if [ $? -eq 0 ]; then
echo "Done." echo -e '\e[1;32mDone\e[0m.'
else else
ret=2 ret=2
echo -e "\\e[1;31m$out\\e[0m"
fi fi
} }