Commit 66d9182c authored by Mikhail Tergoev's avatar Mikhail Tergoev

Add try_ and check_ function. Fix Unarc.dll in setup db

parent 290a6840
......@@ -22,6 +22,6 @@ export PW_WINEDBG_DISABLE=1
export PW_FORCE_DISABLED_GAMEMOD=1 # Force disabele gamemod
export PW_FORCE_LARGE_ADDRESS_AWARE=0 # Force Wine to enable the LARGE_ADDRESS_AWARE flag for all executables. Enabled by default.
#export PULSE_LATENCY_MSEC=60
export PW_DLL_INSTALL="vcrun6 mfc42"
export PW_DLL_INSTALL="vcrun6 mfc42 vcrun6sp6 7zip"
#export LAUNCH_PARAMETERS="-d3d9"
export PW_GUI_DISABLED_CS=1
......@@ -2,38 +2,22 @@
# Author: PortWINE-Linux.ru
. "$(dirname $(readlink -f "$0"))/runlib"
rm -f "${PORT_WINE_PATH}/"*".log"
rm -f "${PORT_WINE_TMP_PATH}/update_notifier"
rm -f "${PORT_WINE_TMP_PATH}/init_run_suc"
rm -fr "${PORT_WINE_PATH}/data/pfx/dosdevices"
rm -fr "${PORT_WINE_PATH}/data/port_on"
rm -fr "${PORT_WINE_PATH}/data/dxvk.conf"
rm -f "${PORT_WINE_PATH}/Create_shortcut_PP.desktop"
rm -f "${PORT_WINE_PATH}/Proton.desktop"
rm -f "${PORT_WINE_PATH}/settings.desktop"
rm -f "${PORT_WINE_PATH}/settings.desktop"
rm -f "${PORT_WINE_PATH}/debug.desktop"
try_remove_file "${PORT_WINE_TMP_PATH}/update_notifier"
try_remove_file "${PORT_WINE_TMP_PATH}/init_run_suc"
if [ -d "${PORT_WINE_PATH}/Settings" ]; then
rm -fr "${PORT_WINE_PATH}/Settings"
fi
if [ ! -z "${PATH_TO_GAME}" ]; then
rm -f "${PATH_TO_GAME}"/*.dxvk-cache
fi
if [ -f "${PORT_WINE_PATH}/restart.desktop" ]; then
rm "${PORT_WINE_PATH}/restart.desktop"
fi
if [ ! -d "/home/${USER}/.local/share/applications" ]
then
mkdir -p "/home/${USER}/.local/share/applications"
else
if [ -e "/home/${USER}/.local/share/applications/Create_shortcut_PP.desktop" ]; then
rm -f "/home/${USER}/.local/share/applications/Create_shortcut_PP.desktop"
fi
if [ -e "/home/${USER}/.local/share/applications/Proton.desktop" ]; then
rm -f "/home/${USER}/.local/share/applications/Proton.desktop"
fi
fi
try_remove_file "${PORT_WINE_PATH}/data/port_on"
try_remove_file "${PORT_WINE_PATH}/data/dxvk.conf"
try_remove_file "${PORT_WINE_PATH}/Create_shortcut_PP.desktop"
try_remove_file "${PORT_WINE_PATH}/Proton.desktop"
try_remove_file "${PORT_WINE_PATH}/settings.desktop"
try_remove_file "${PORT_WINE_PATH}/settings.desktop"
try_remove_file "${PORT_WINE_PATH}/debug.desktop"
try_remove_file "${PORT_WINE_PATH}/restart.desktop"
try_remove_dir "${PORT_WINE_PATH}/data/pfx/dosdevices"
try_remove_dir "${PORT_WINE_PATH}/Settings"
create_new_dir "/home/${USER}/.local/share/applications"
if ! [ "${portname}" = "PortProton" ]; then
name_desktop="${gamename}"
......@@ -84,9 +68,8 @@ do
chmod u+x "${PORT_WINE_PATH}/${name_desktop}.desktop"
done
chmod u+x "${PORT_SCRIPTS_PATH}/"*
if [ ! -d "${PORT_WINE_PATH}/drive_c" ]; then
ln -s "${PORT_WINE_PATH}/data/pfx/drive_c/" "${PORT_WINE_PATH}/drive_c"
fi
try_force_link_dir "${PORT_WINE_PATH}/data/pfx/drive_c/" "${PORT_WINE_PATH}/drive_c"
if [ -d "${PORT_WINE_PATH}/data/pfx/drive_c/users/Public" ] && [ ! -L "${PORT_WINE_PATH}/data/pfx/drive_c/users/Public" ]; then
cp -fr "${PORT_WINE_PATH}/data/pfx/drive_c/users/Public"/* "${PORT_WINE_PATH}/data/pfx/drive_c/users/steamuser/"
rm -fr "${PORT_WINE_PATH}/data/pfx/drive_c/users/Public"
......@@ -94,13 +77,16 @@ elif [ -L "${PORT_WINE_PATH}/data/pfx/drive_c/users/Public" ]; then
rm -fr "${PORT_WINE_PATH}/data/pfx/drive_c/users/Public"
fi
ln -s "${PORT_WINE_PATH}/data/pfx/drive_c/users/steamuser" "${PORT_WINE_PATH}/data/pfx/drive_c/users/Public"
if [ ! -d "${PORT_WINE_PATH}/data/pfx/drive_c/users/${USER}" ]; then
ln -s "${PORT_WINE_PATH}/data/pfx/drive_c/users/steamuser" "${PORT_WINE_PATH}/data/pfx/drive_c/users/${USER}"
fi
if [ -e "${PORT_WINE_PATH}/data/pfx/system.reg" ] || [ -e "${PORT_WINE_PATH}/data/pfx/user.reg" ] || [ -e "${PORT_WINE_PATH}/data/pfx/userdef.reg" ]; then
sed -i "s/xuser/${USER}/g" "${PORT_WINE_PATH}/data/pfx/"*.reg
sed -i "s/vagrant/${USER}/g" "${PORT_WINE_PATH}/data/pfx/"*.reg
fi
if [ "${s_install}" = "1" ]; then
echo "Installation completed successfully."
else
......
......@@ -47,7 +47,7 @@ if [ -x "`which wrestool 2>/dev/null`" ]; then
cp -f "${PORTPROTON_EXE}.ico" "${PORT_WINE_PATH}/data/img/${PORTPROTON_NAME}.ico"
rm -f "${PORTPROTON_PATH}/"*.ico
fi
if [ $? -eq 1 ];then exit 1; fi
if [ $? -eq 1 ] ; then exit 1 ; fi
export PW_VULKAN_TO_DB=`cat "${PORT_WINE_TMP_PATH}/pw_vulkan"`
if [ ! -z "${PORTWINE_DB}" ]; then
PORTWINE_DB_FILE=`grep -il "${PORTWINE_DB}" "${PORT_SCRIPTS_PATH}/portwine_db"/* | sed s/".exe"/""/gi`
......@@ -147,9 +147,7 @@ echo "log WINE:" >> "${PORT_WINE_PATH}/${portname}.log"
export DXVK_HUD="full"
export PW_XTERM="${WINELIB}/amd64/usr/bin/xterm -l -lf ${PORT_WINE_PATH}/${portname}.log.wine -geometry 159x37 -e"
if [ -f "${PORT_WINE_PATH}/${portname}.log.wine" ]; then
rm -f "${PORT_WINE_PATH}/${portname}.log.wine"
fi
try_remove_file "${PORT_WINE_PATH}/${portname}.log.wine"
if [ ! -z "${portwine_exe}" ]; then
export PATH_TO_GAME="$( cd "$( dirname "${portwine_exe}" )" >/dev/null 2>&1 && pwd )"
cd "$PATH_TO_GAME"
......@@ -168,21 +166,19 @@ else
export PATH_TO_GAME="$( cd "$( dirname "${gamestart}" )" >/dev/null 2>&1 && pwd )"
cd "$PATH_TO_GAME"
if [ ! -z $optirun_on ]; then
$PW_XTERM "${WINELOADER}" ${optirun_on} "${gamestart}" ${LAUNCH_PARAMETERS} 2>&1 &
${optirun_on} $PW_XTERM "${PW_RUNTIME}" "${WINELOADER}" "${gamestart}" ${LAUNCH_PARAMETERS} 2>&1 &
else
$PW_XTERM "${WINELOADER}" "${gamestart}" ${LAUNCH_PARAMETERS} 2>&1 &
$PW_XTERM "${PW_RUNTIME}" "${WINELOADER}" "${gamestart}" ${LAUNCH_PARAMETERS} 2>&1 &
fi
fi
zenity --info --title "DEBUG" --text "${port_debug}" --no-wrap && "${WINESERVER}" -k
STOP_PORTWINE | sszen
cat "${PORT_WINE_PATH}/${portname}.log.wine" >> "${PORT_WINE_PATH}/${portname}.log"
rm -f "${PORT_WINE_PATH}/${portname}.log.wine"
try_remove_file "${PORT_WINE_PATH}/${portname}.log.wine"
deb_text=$(cat "${PORT_WINE_PATH}/${portname}.log" | awk '! a[$0]++')
echo "$deb_text" > "${PORT_WINE_PATH}/${portname}.log"
echo "$deb_text" | zenity --text-info --editable \
--width=800 --height=600 \
--title="${portname}.log"
echo "$deb_text" | zenity --text-info --editable --width=800 --height=600 --title="${portname}.log"
}
########################################################################
PW_WINECFG ()
......@@ -215,7 +211,7 @@ PW_WINETRICKS ()
UPDATE_WINETRICKS
export PW_USE_TERMINAL=1
START_PORTWINE
$PW_TERM "${PORT_WINE_TMP_PATH}/winetricks" -q --force
$PW_TERM "${PW_RUNTIME}" "${PORT_WINE_TMP_PATH}/winetricks" -q --force
}
########################################################################
if [ ! -z "${portwine_exe}" ]; then
......
......@@ -19,12 +19,12 @@ export PROGS_INST=""
export vexit=0
for PROGS in "wget" "curl" "tar"
do
if [ ! -x "`which "${PROGS}" 2>/dev/null`" ];then
if [ ! -x "`which "${PROGS}" 2>/dev/null`" ] ; then
PROGS_INST="${PROGS_INST} ${PROGS}"
vexit=1
fi
done
if [ "${vexit}" -eq "1" ];then
if [ "${vexit}" -eq "1" ] ; then
echo "You will need to install: ${PROGS_INST}, and restart the script"
exit 1
fi
......@@ -36,10 +36,10 @@ ARCH_NAME="${setup_script}.tar.xz"
deflink="/home/${USER}/PortWINE/${portname}"
[ $(id -u) -eq 0 ] && echo "Do not run the script from the superuser!" && zenity --error --text "Do not run the script from the superuser!" 2> /dev/null && exit 1
########################################################################
if [ "$1" = "-rus" ]; then
if [ "$1" = "-rus" ] ; then
SET_LANG="Russian"
export s_install="1"
elif [ "$1" = "-eng" ]; then
elif [ "$1" = "-eng" ] ; then
SET_LANG="English"
export s_install="1"
else
......@@ -47,7 +47,7 @@ else
--column="Set:" --column "Language:" \
TRUE "Russian" \
FALSE "English" ` 2> /dev/null
if [ $? -eq 1 ];then exit 1; fi
if [ $? -eq 1 ] ; then exit 1 ; fi
case $SET_LANG in
"Russian")
INFO_TEXT="Вы запустили установщик PortWINE ${gamename} версии ${port_ver}. \n\nЭто не коммерческий продукт и развивается исключительно за идею и Ваши пожертвования. \nВсе права сторонего програмного обеспечения принадлежат их владельцам! \nПродолжая установку вы автоматически соглашаетесь с данными условиями." > /dev/null 2>&1 ;;
......@@ -55,10 +55,10 @@ else
INFO_TEXT="You run the installer PortWINE ${gamename} v. ${port_ver}. \n\nThis is not a commercial product and developed exclusively for the idea and donate. \nAll rights to third-party software belong to their respective owners! \nContinuing the installation of you agree to these terms." > /dev/null 2>&1 ;;
esac
`zenity --info --title "INFO" --text "$INFO_TEXT" --no-wrap ` 2> /dev/null
if [ $? -eq 1 ];then echo "error" && exit 1; fi
if [ $? -eq 1 ] ; then echo "error" && exit 1 ; fi
fi
########################################################################
if [ "${s_install}" = "1" ]; then
if [ "${s_install}" = "1" ] ; then
echo "${portname} is installed in ${deflink}"
D_PATH="${deflink}"
else
......@@ -68,7 +68,7 @@ else
--column="Выбор" --column "Путь:" \
TRUE "${deflink}" \
FALSE "Другой путь..." ` 2> /dev/null
if [ $? -eq 1 ];then exit 1; fi
if [ $? -eq 1 ] ; then exit 1 ; fi
case $inst1 in
"${deflink}")
D_PATH="${deflink}" ;;
......@@ -90,10 +90,10 @@ else
D_PATH="${D_PATH}/${portname}" ;;
esac ;;
esac
if [ $? -eq 1 ];then echo "error" && exit 1; fi
if [ $? -eq 1 ] ; then echo "error" && exit 1 ; fi
fi
########################################################################
if [ "${s_install}" != "1" ]; then
if [ "${s_install}" != "1" ] ; then
case $SET_LANG in
"Russian")
zen() {
......@@ -104,16 +104,16 @@ if [ "${s_install}" != "1" ]; then
zenity --progress --title="Install..." --text="Install ${portname}" --pulsate --auto-close --auto-kill --width=450 > /dev/null 2>&1
} ;;
esac
if [ $? -eq 1 ];then echo "error" && exit 1; fi
if [ $? -eq 1 ] ; then echo "error" && exit 1 ; fi
fi
########################################################################
export PORT_WINE_PATH="${D_PATH}"
if [ ! -d "${PORT_WINE_PATH}" ];then
if [ ! -d "${PORT_WINE_PATH}" ] ; then
mkdir -p "$PORT_WINE_PATH"
else
for CLEAN_PORT in "dist" "dist_dxvk" "dist_vkd3d" "libs" "tmp"
do
if [ -d "${PORT_WINE_PATH}/data/${CLEAN_PORT}" ];then
if [ -d "${PORT_WINE_PATH}/data/${CLEAN_PORT}" ] ; then
rm -fR "${PORT_WINE_PATH}/data/${CLEAN_PORT}"
fi
done
......@@ -134,14 +134,14 @@ case $SET_LANG in
"English")
echo "ENG" > "${PORT_WINE_PATH}/data/tmp/${portname}_loc" ;;
esac
if [ $? -eq 1 ];then echo "error" && exit 1; fi
if [ $? -eq 1 ] ; then echo "error" && exit 1 ; fi
export PORT_WINE_TMP_PATH="${PORT_WINE_PATH}/data/tmp"
read "update_loc" < "${PORT_WINE_TMP_PATH}/${portname}_loc"
export update_loc=${update_loc}
########################################################################
cd "${PORT_WINE_PATH}"
tail -n +162 "${links}/${setup_script}" > "${PORT_WINE_PATH}/${ARCH_NAME}"
if [ "${s_install}" = "1" ]; then
if [ "${s_install}" = "1" ] ; then
tar -Jxvf "${PORT_WINE_PATH}/${ARCH_NAME}" -C "${PORT_WINE_PATH}/"
else
tar -Jxvf "${PORT_WINE_PATH}/${ARCH_NAME}" -C "${PORT_WINE_PATH}/" | zen
......@@ -150,7 +150,7 @@ chmod 755 -R "${PORT_WINE_PATH}"
mv -f "${PORT_WINE_PATH}/${ARCH_NAME}" "${PORT_WINE_PATH}/data/tmp"
sed -n 1,161p "${links}/${setup_script}" > "${PORT_WINE_PATH}/data/tmp/${setup_script}"
########################################################################
if [ -d "${PORT_PFX}_old" ];then
if [ -d "${PORT_PFX}_old" ] ; then
rm -fR "${PORT_PFX}"
mv -f "${PORT_PFX}_old" "${PORT_PFX}"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment