Commit cfb08dd7 authored by Mikhail Tergoev's avatar Mikhail Tergoev

added automove old PP to new PPFP

parent 20ac7934
......@@ -448,6 +448,8 @@ if [[ "${update_loc}" == "RUS" ]] ; then
export loc_gui_terminal="ТЕРМИНАЛ"
export loc_gui_logo="ЛОГО"
export FOUND_OLD_PP="Обнаружен PortProton, установленный скриптом. Желаете перенести все данные из него, в новую flatpak версию PortProton?"
export MOVED_OLD_PP="PortProton перенесен во flatpak. Все пути в ярлыках и в сторонних играх библиотеки стима исправлены на новые. Теперь вы можете удалить старый каталог:"
elif [[ "${update_loc}" == "ENG" ]] ; then
......@@ -868,4 +870,7 @@ A brief instruction:
export loc_gui_terminal="TERMINAL"
export loc_gui_logo="LOGO"
export FOUND_OLD_PP="PortProton installed by script has been detected. Do you want to transfer all the data from it to the new flatpak version of PortProton?"
export MOVED_OLD_PP="PortProton has been moved to flatpak. You can now remove the old directory:"
fi
#!/usr/bin/env bash
# Author: linux-gaming.ru
export INSTALLING_PORT=1
. "$(dirname $(readlink -f "$0"))/start.sh"
if check_flatpak
......@@ -39,6 +40,62 @@ if [[ -f "${HOME}/.local/share/applications/PortProton.desktop" ]] && [[ -f /usr
try_remove_file "${HOME}/.local/share/applications/PortProton.desktop"
fi
if check_flatpak \
&& [[ ! -f /usr/bin/portproton ]] \
&& [[ -f "${HOME}/.local/share/applications/PortProton.desktop" ]] ; then
PORT_WINE_OLD_PATH="$(cat "${HOME}/.local/share/applications/PortProton.desktop" | grep "Exec=" | awk -F'env ' '{print $2}' | awk -F'/data/scripts/' '{print $1}')"
if [[ -d "$PORT_WINE_OLD_PATH" ]] \
&& yad_question "$FOUND_OLD_PP"
then
pw_start_progress_bar_block "$loc_gui_settings"
try_remove_file "${HOME}/.local/share/applications/PortProton.desktop"
try_remove_file "${PORT_WINE_OLD_PATH}"/PortProton.desktop
try_remove_file "${PORT_WINE_OLD_PATH}"/readme.desktop
try_remove_dir "${PORT_WINE_PATH}/data/dist"
mv -f "${PORT_WINE_OLD_PATH}"/data/dist "${PORT_WINE_PATH}/data/"
try_remove_dir "${PORT_WINE_PATH}/data/prefixes"
mv -f "${PORT_WINE_OLD_PATH}"/data/prefixes "${PORT_WINE_PATH}/data/"
try_remove_dir "${PORT_WINE_PATH}/data/tmp/mono"
mv -f "${PORT_WINE_OLD_PATH}"/data/tmp/mono "${PORT_WINE_PATH}/data/tmp/"
try_remove_dir "${PORT_WINE_PATH}/data/tmp/gecko"
mv -f "${PORT_WINE_OLD_PATH}"/data/tmp/gecko "${PORT_WINE_PATH}/data/tmp/"
cp -f "${PORT_WINE_OLD_PATH}"/data/img/*.png "${PORT_WINE_PATH}"/data/img/
cp -f "${PORT_WINE_OLD_PATH}"/*.desktop "${PORT_WINE_PATH}"/
sed -i "s|env \"${PORT_WINE_OLD_PATH}/data/scripts/start.sh\"|$PW_EXEC|g" "${PORT_WINE_PATH}"/*.desktop
sed -i "s|${PORT_WINE_OLD_PATH}|${PORT_WINE_PATH}|g" "${PORT_WINE_PATH}"/*.desktop
sed -i "s|env \"${PORT_WINE_OLD_PATH}/data/scripts/start.sh\"|$PW_EXEC|g" "${HOME}/.local/share/applications"/*.desktop
sed -i "s|${PORT_WINE_OLD_PATH}|${PORT_WINE_PATH}|g" "${HOME}/.local/share/applications"/*.desktop
sed -i "s|env \"${PORT_WINE_OLD_PATH}/data/scripts/start.sh\"|$PW_EXEC|g" "$(xdg-user-dir DESKTOP)"/*.desktop
sed -i "s|${PORT_WINE_OLD_PATH}|${PORT_WINE_PATH}|g" "$(xdg-user-dir DESKTOP)"/*.desktop
if [[ -d "${PORT_WINE_OLD_PATH}"/steam_scripts/ ]] ; then
create_new_dir "${PORT_WINE_PATH}/steam_scripts/"
cp -f "${PORT_WINE_OLD_PATH}"/steam_scripts/* "${PORT_WINE_PATH}"/steam_scripts/
sed -i "s|\"${PORT_WINE_OLD_PATH}/data/scripts/start.sh\"|$PW_EXEC|g" "${PORT_WINE_PATH}"/steam_scripts/*
for STUIDPATH in "${HOME}"/.local/share/Steam/userdata/*/ ; do
SCPATH="${STUIDPATH}/config/shortcuts.vdf"
if [[ -f "$SCPATH" ]]
then sed -i "s|${PORT_WINE_OLD_PATH}|${PORT_WINE_PATH}|g" "$SCPATH"
else break
fi
done
fi
pw_stop_progress_bar
yad_info "${MOVED_OLD_PP} ${PORT_WINE_OLD_PATH}"
fi
fi
unset INSTALLING_PORT
echo "Restarting PP after installing..."
......
......@@ -145,10 +145,6 @@ try_remove_file "${PORT_SCRIPTS_PATH}/yad_gui"
try_remove_file "${PORT_SCRIPTS_PATH}/zen_yad_gui"
try_remove_file "${PW_GUI_THEMES_PATH}/default.css"
if [[ "${INSTALLING_PORT}" == 1 ]] ; then
return 0
fi
. "${USER_CONF}"
# подключаем тему:
......@@ -165,6 +161,10 @@ if [[ $(gsettings get org.gnome.desktop.interface color-scheme) == "'prefer-dark
then export PW_DESKTOP_THEME="dark"
fi
if [[ "${INSTALLING_PORT}" == 1 ]] ; then
return 0
fi
if [[ "${SKIP_CHECK_UPDATES}" != 1 ]] \
&& [[ ! -f "/tmp/portproton.lock" ]]
then
......
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