From c5811cea89ba4b75283855d1f8d1f18b4deefb0b Mon Sep 17 00:00:00 2001 From: ZHANG Yuntian Date: Mon, 19 Aug 2024 18:28:29 +0800 Subject: [PATCH] fix: check if gdm config file exist before editing Signed-off-by: ZHANG Yuntian --- src/usr/lib/rsetup/cli/system.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/usr/lib/rsetup/cli/system.sh b/src/usr/lib/rsetup/cli/system.sh index 721ed2f..b4afd46 100644 --- a/src/usr/lib/rsetup/cli/system.sh +++ b/src/usr/lib/rsetup/cli/system.sh @@ -245,8 +245,12 @@ set_gdm_autologin() { local user="$1" switch="$2" local config_dir="/etc/gdm3" + if [[ ! -f $config_dir/daemon.conf ]]; then + echo "gdm is not installed. Auto login will not be configured." >&2 + return 1 + fi + if [[ "$switch" == "ON" ]]; then - mkdir -p "$config_dir" sed -i '/^# Rsetup/,/# Rsetup$/d' $config_dir/daemon.conf cat << EOF | tee -a $config_dir/daemon.conf >/dev/null # Rsetup