From c3e994ab103013179753b4f9a173b7d6149737e4 Mon Sep 17 00:00:00 2001 From: Boris Yumankulov Date: Tue, 10 Jun 2025 16:52:34 +0500 Subject: [PATCH] fix: prevert multiple autologin config write on using GDM Signed-off-by: Boris Yumankulov --- usr/bin/portproton-session-select | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/usr/bin/portproton-session-select b/usr/bin/portproton-session-select index 711b193..0465bf8 100755 --- a/usr/bin/portproton-session-select +++ b/usr/bin/portproton-session-select @@ -132,8 +132,20 @@ if [[ ! -z $4 ]]; then fi if systemctl is-active --quiet gdm; then - yad --window-icon="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --title="Требуется подтверждение" --text="Для работы данной функии требуется LIGHTDM или SDDM, GDM не поддерживается" --width=290 --text-align=center --button="OK" - echo "autologin=false" >> "$config_dir/$SENTINEL_FILE" + yad --window-icon="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --title="Требуется подтверждение" --text="Для работы данной функции требуется LIGHTDM или SDDM, GDM не поддерживается" --width=290 --text-align=center --button="OK" + if [[ -f "$config_dir/$SENTINEL_FILE" ]]; then + if grep -iq "autologin" "$config_dir/$SENTINEL_FILE"; then + if ! grep -q "autologin=false" "$config_dir/$SENTINEL_FILE"; then + sed -i 's/autologin=.*/autologin=false/' "$config_dir/$SENTINEL_FILE" + echo "autologin set to false" + else + echo "autologin already set to false" + fi + else + echo "autologin=false" >> "$config_dir/$SENTINEL_FILE" + echo "autologin added as false" + fi + fi die "Autologin configuration aborted due to GDM." fi