Commit 4c0e2c44 authored by Mikhail Tergoev's avatar Mikhail Tergoev

fix use xterm in flatpak

parent 5bd03731
...@@ -242,10 +242,6 @@ check_gamescope_session () { ...@@ -242,10 +242,6 @@ check_gamescope_session () {
then [[ "$GAMESCOPE_IN_USE" == 1 ]] && return 0 || return 1 then [[ "$GAMESCOPE_IN_USE" == 1 ]] && return 0 || return 1
fi fi
if echo "${DESKTOP_SESSION}" | grep -i "gamescope" &>/dev/null ; then if echo "${DESKTOP_SESSION}" | grep -i "gamescope" &>/dev/null ; then
if command -v konsole &>/dev/null
then export PW_TERM="konsole --hide-menubar --fullscreen -e"
else export PW_TERM="xdg-terminal"
fi
export GAMESCOPE_IN_USE=1 export GAMESCOPE_IN_USE=1
return 0 return 0
else else
...@@ -530,9 +526,16 @@ pw_init_runtime () { ...@@ -530,9 +526,16 @@ pw_init_runtime () {
if [[ "$PW_USE_RUNTIME" != "1" ]] \ if [[ "$PW_USE_RUNTIME" != "1" ]] \
|| [[ "$PW_WINE_USE" == "USE_SYSTEM_WINE" ]] || [[ "$PW_WINE_USE" == "USE_SYSTEM_WINE" ]]
then then
var_ld_library_path_update "${PW_PLUGINS_PATH}/portable/lib/lib64:${PW_PLUGINS_PATH}/portable/lib/lib32" export PW_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${PW_PLUGINS_PATH}/portable/lib/lib64:${PW_PLUGINS_PATH}/portable/lib/lib32"
export PW_LD_LIBRARY_PATH="${LD_LIBRARY_PATH}"
export PW_VK_LAYER_PATH="${PW_PLUGINS_PATH}/portable/share/vulkan/implicit_layer.d" export PW_VK_LAYER_PATH="${PW_PLUGINS_PATH}/portable/share/vulkan/implicit_layer.d"
if check_flatpak \
&& check_gamescope_session
then PW_TERM="xterm -fullscreen -bg black -fg white -e"
elif check_flatpak
then PW_TERM="xterm -bg black -fg white -e"
else PW_TERM="env LD_LIBRARY_PATH=\"${PW_LD_LIBRARY_PATH}\" ${PW_PLUGINS_PATH}/portable/bin/xterm -bg black -fg white -e"
fi
export PW_TERM
export pw_runtime="" export pw_runtime=""
return 0 return 0
fi fi
...@@ -601,6 +604,8 @@ ${PW_PV_OVERRIDES}/i386-linux-gnu/aliases:\ ...@@ -601,6 +604,8 @@ ${PW_PV_OVERRIDES}/i386-linux-gnu/aliases:\
fi fi
done done
export PW_TERM="env LD_LIBRARY_PATH=\"${PW_LD_LIBRARY_PATH}\" ${PW_PLUGINS_PATH}/portable/bin/xterm -bg black -fg white -e"
print_info "RUNTIME is enabled" print_info "RUNTIME is enabled"
} }
...@@ -819,7 +824,7 @@ pw_download_libs () { ...@@ -819,7 +824,7 @@ pw_download_libs () {
} }
pw_check_and_download_wine () { pw_check_and_download_wine () {
[ ! -d "${PORT_WINE_PATH}/data/dist/" ] && create_new_dir "${PORT_WINE_PATH}/data/dist" [[ ! -d "${PORT_WINE_PATH}/data/dist/" ]] && create_new_dir "${PORT_WINE_PATH}/data/dist"
if [[ "${PW_WINE_USE}" == "GET-OTHER-WINE" ]] ; then if [[ "${PW_WINE_USE}" == "GET-OTHER-WINE" ]] ; then
gui_proton_downloader gui_proton_downloader
fi fi
...@@ -2225,7 +2230,7 @@ pw_winecmd () { ...@@ -2225,7 +2230,7 @@ pw_winecmd () {
export PW_USE_TERMINAL=1 export PW_USE_TERMINAL=1
start_portwine start_portwine
cd "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/drive_c" cd "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/drive_c"
${pw_runtime} env LD_LIBRARY_PATH="${PW_LD_LIBRARY_PATH}:${WINE_LIBRARY_PATH}" "${PW_PLUGINS_PATH}/portable/bin/xterm" -e "${WINELOADER}" cmd ${pw_runtime} ${PW_TERM} "${WINELOADER}" cmd
stop_portwine stop_portwine
} }
...@@ -2241,13 +2246,12 @@ pw_start_cont_xterm () { ...@@ -2241,13 +2246,12 @@ pw_start_cont_xterm () {
pw_init_runtime pw_init_runtime
${pw_runtime} \ ${pw_runtime} \
env PATH="${PATH}" \ env PATH="${PATH}" \
LD_LIBRARY_PATH="${PW_LD_LIBRARY_PATH}" \
LD_PRELOAD="${PW_LD_PRELOAD}" \ LD_PRELOAD="${PW_LD_PRELOAD}" \
VK_LAYER_PATH="${PW_VK_LAYER_PATH}" \ VK_LAYER_PATH="${PW_VK_LAYER_PATH}" \
VK_INSTANCE_LAYERS="${PW_VK_INSTANCE_LAYERS}" \ VK_INSTANCE_LAYERS="${PW_VK_INSTANCE_LAYERS}" \
${PW_GAMEMODERUN_SLR} \ ${PW_GAMEMODERUN_SLR} \
${PW_MANGOHUD_SLR} \ ${PW_MANGOHUD_SLR} \
"${PW_PLUGINS_PATH}/portable/bin/xterm" ${PW_TERM} bash
} }
yad_info () { yad_info () {
...@@ -2674,13 +2678,20 @@ gui_proton_downloader () { ...@@ -2674,13 +2678,20 @@ gui_proton_downloader () {
exit 0 exit 0
fi fi
for INSTALLING_VERSION_IN_DIST in $(ls "${PORT_WINE_PATH}/data/dist/") ; do for INSTALLING_VERSION_IN_DIST in $(ls "${PORT_WINE_PATH}/data/dist/") ; do
sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git" sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git" sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git" sed -i "/${INSTALLING_VERSION_IN_DIST}$/Id" "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git"
[[ -z "$(cat "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git")" ]] && echo "nothing" > "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git"
done done
[[ -z "$(cat "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git")" ]] && echo "nothing" >"${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
[[ -z "$(cat "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git")" ]] && echo "nothing" >"${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
[[ -z "$(cat "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git")" ]] && echo "nothing" >"${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
[[ -z "$(cat "${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git")" ]] && echo "nothing" >"${PORT_WINE_TMP_PATH}/tmp_wine_ge_custom_git"
# Installed wine # Installed wine
ls -l ${PORT_WINE_PATH}/data/dist | awk '{print $9}' | sed '/^$/d' > ${PORT_WINE_TMP_PATH}/tmp_installed_wine ls -l ${PORT_WINE_PATH}/data/dist | awk '{print $9}' | sed '/^$/d' 1> ${PORT_WINE_TMP_PATH}/tmp_installed_wine
if [[ "$1" != "silent" ]] ; then if [[ "$1" != "silent" ]] ; then
# GUI # GUI
export KEY_WINE=$RANDOM export KEY_WINE=$RANDOM
...@@ -2734,6 +2745,13 @@ gui_proton_downloader () { ...@@ -2734,6 +2745,13 @@ gui_proton_downloader () {
exit 0 exit 0
fi fi
if [[ "${VERSION_WINE_GIT}" == "nothing" ]] ; then
print_info "Nothing to do."
export SKIP_CHECK_UPDATES=1
/usr/bin/env bash -c ${pw_full_command_line[*]} &
exit 0
fi
try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git" try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_pw_git"
try_remove_file "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git" try_remove_file "${PORT_WINE_TMP_PATH}/tmp_wine_kron4ek_git"
try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git" try_remove_file "${PORT_WINE_TMP_PATH}/tmp_proton_ge_git"
...@@ -3432,23 +3450,21 @@ pw_create_prefix_backup () { ...@@ -3432,23 +3450,21 @@ pw_create_prefix_backup () {
| awk -F\" '{print $1}' > "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.create_shortcut" | awk -F\" '{print $1}' > "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.create_shortcut"
fi fi
unset PW_SANDBOX_HOME_PATH unset PW_SANDBOX_HOME_PATH
export PW_ADD_TO_ARGS_IN_RUNTIME="--xterm"
pw_init_runtime pw_init_runtime
if check_flatpak
then TMP_ALL_PATH=""
else TMP_ALL_PATH="env PATH=\"${PATH}\" LD_LIBRARY_PATH=\"${PW_LD_LIBRARY_PATH}\""
fi
chmod -R u+w "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}" chmod -R u+w "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}"
${pw_runtime} env PATH="${PATH}" LD_LIBRARY_PATH="${PW_LD_LIBRARY_PATH}" mksquashfs "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}" "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack.part" -comp zstd & cat << EOF > /tmp/pp_pfx_backup.sh
sleep 10 #!/usr/bin/env bash
while true ; do ${TMP_ALL_PATH} mksquashfs "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}" \
if [[ ! -z $(pgrep -a xterm | grep ".ppack.part" | head -n 1 | awk '{print $1}') ]] ; then "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack.part" -comp zstd \
sleep 0.5 || rm -f "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack.part"
else EOF
kill -TERM $(pgrep -a mksquashfs | grep ".ppack.part" | head -n 1 | awk '{print $1}') chmod u+x /tmp/pp_pfx_backup.sh
sleep 0.3 ${pw_runtime} ${PW_TERM} /tmp/pp_pfx_backup.sh
if [[ -z "$(pgrep -a mksquashfs | grep ".ppack.part" | head -n 1 | awk '{print $1}')" ]] try_remove_file /tmp/pp_pfx_backup.sh
then break
else sleep 0.3
fi
fi
done
if [[ -f "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack.part" ]] ; then if [[ -f "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack.part" ]] ; then
mv -f "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack.part" "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack" mv -f "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack.part" "${PW_PREFIX_TO_BACKUP}/${PW_PREFIX_NAME}.ppack"
yad_info "$PW_PFX_BACKUP_SUCCESS $PW_PREFIX_NAME" yad_info "$PW_PFX_BACKUP_SUCCESS $PW_PREFIX_NAME"
...@@ -3459,7 +3475,6 @@ pw_create_prefix_backup () { ...@@ -3459,7 +3475,6 @@ pw_create_prefix_backup () {
else else
yad_error "$PW_PFX_BACKUP_ERROR $PW_PREFIX_NAME" yad_error "$PW_PFX_BACKUP_ERROR $PW_PREFIX_NAME"
fi fi
return 0 return 0
} }
......
...@@ -216,34 +216,40 @@ fi ...@@ -216,34 +216,40 @@ fi
[[ "$MISSING_DESKTOP_FILE" == 1 ]] && portwine_missing_shortcut [[ "$MISSING_DESKTOP_FILE" == 1 ]] && portwine_missing_shortcut
if [[ ! -z $(basename "${portwine_exe}" | grep .ppack) ]] ; then if [[ ! -z $(basename "${portwine_exe}" | grep .ppack) ]] ; then
export PW_ADD_TO_ARGS_IN_RUNTIME="--xterm"
unset PW_SANDBOX_HOME_PATH unset PW_SANDBOX_HOME_PATH
pw_init_runtime pw_init_runtime
if check_flatpak
then TMP_ALL_PATH=""
else TMP_ALL_PATH="env PATH=\"${PATH}\" LD_LIBRARY_PATH=\"${PW_LD_LIBRARY_PATH}\""
fi
export PW_PREFIX_NAME=$(basename "$1" | awk -F'.' '{print $1}') export PW_PREFIX_NAME=$(basename "$1" | awk -F'.' '{print $1}')
${pw_runtime} "${PW_PLUGINS_PATH}/portable/bin/xterm" -e env PATH="${PATH}" LD_LIBRARY_PATH="${PW_LD_LIBRARY_PATH}" unsquashfs -f -d "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}" "$1" & cat << EOF > /tmp/pp_pfx_unpack.sh
sleep 10 #!/usr/bin/env bash
while true ; do ${TMP_ALL_PATH} unsquashfs -f -d "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}" "$1" \
if [[ ! -z $(pgrep -a xterm | grep ".ppack" | head -n 1 | awk '{print $1}') ]] ; then || echo "ERROR" >/tmp/pp_pfx_unpack_error
sleep 0.5 EOF
chmod u+x /tmp/pp_pfx_unpack.sh
${pw_runtime} ${PW_TERM} /tmp/pp_pfx_unpack.sh
if grep "ERROR" /tmp/pp_pfx_unpack_error &>/dev/null ; then
try_remove_file /tmp/pp_pfx_unpack_error
try_remove_file /tmp/pp_pfx_unpack.sh
yad_error "Unpack has FAILED for prefix: <b>\"${PW_PREFIX_NAME}\"</b>."
exit 1
else
try_remove_file /tmp/pp_pfx_unpack.sh
if [[ -f "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.create_shortcut" ]] ; then
orig_IFS="$IFS"
IFS=$'\n'
for crfb in $(cat "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.create_shortcut") ; do
export portwine_exe="${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/${crfb}"
portwine_create_shortcut "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/${crfb}"
done
IFS="$orig_IFS"
else else
kill -TERM $(pgrep -a unsquashfs | grep ".ppack" | head -n 1 | awk '{print $1}') yad_info "Unpack is DONE for prefix: <b>\"${PW_PREFIX_NAME}\"</b>."
sleep 0.3
if [[ -z "$(pgrep -a unsquashfs | grep ".ppack" | head -n 1 | awk '{print $1}')" ]]
then break
else sleep 0.3
fi
fi fi
done exit 0
if [[ -f "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.create_shortcut" ]] ; then
orig_IFS="$IFS"
IFS=$'\n'
for crfb in $(cat "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/.create_shortcut") ; do
export portwine_exe="${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/${crfb}"
portwine_create_shortcut "${PORT_WINE_PATH}/data/prefixes/${PW_PREFIX_NAME}/${crfb}"
done
IFS="$orig_IFS"
fi fi
exit 0
fi fi
### CLI ### ### CLI ###
......
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