updated sddm_theme.sh

This commit is contained in:
JaKooLit 2025-02-16 14:19:15 +09:00
parent 8e972b6c13
commit 74f1b6ea84

View File

@ -55,24 +55,20 @@ if git clone --depth 1 "$source_theme" "$theme_name"; then
echo -e "${NOTE} Setting up the login screen." | tee -a "$LOG" echo -e "${NOTE} Setting up the login screen." | tee -a "$LOG"
if [ -d "$sddm_conf_dir" ]; then if [ -d "$sddm_conf_dir" ]; then
# If the directory exists, backup present files
echo "Backing up files in $sddm_conf_dir" | tee -a "$LOG" echo "Backing up files in $sddm_conf_dir" | tee -a "$LOG"
for file in "$sddm_conf_dir"/*; do for file in "$sddm_conf_dir"/*; do
if [ -f "$file" ]; then if [ -f "$file" ]; then
# not change the backed up files
if [[ "$file" == *$BACKUP_SUFFIX ]]; then if [[ "$file" == *$BACKUP_SUFFIX ]]; then
echo "Skipping backup file: $file" | tee -a "$LOG" echo "Skipping backup file: $file" | tee -a "$LOG"
continue continue
fi fi
# Backup each original file # Backup each original file
sudo cp "$file" "$file$BACKUP_SUFFIX" 2>&1 | tee -a "$LOG" sudo cp "$file" "$file$BACKUP_SUFFIX" 2>&1 | tee -a "$LOG"
echo "Backup created for $file" | tee -a "$LOG" echo "Backup created for $file" | tee -a "$LOG"
# editing present files in "/etc/sddm.conf.d" # Edit existing "Current="
if grep -q '^[[:space:]]*Current=' "$file"; then if grep -q '^[[:space:]]*Current=' "$file"; then
sudo sed -i 's/^[[:space:]]*Current=/#&/' "$file" 2>&1 | tee -a "$LOG" sudo sed -i "s/^[[:space:]]*Current=.*/Current=$theme_name/" "$file" 2>&1 | tee -a "$LOG"
sudo sed -i "s/^[[:space:]]*#Current=.*/Current=$theme_name/" "$file" 2>&1 | tee -a "$LOG"
echo "Updated theme in $file" | tee -a "$LOG" echo "Updated theme in $file" | tee -a "$LOG"
fi fi
fi fi