Files
provision/scripts/update-xdm.sh
2025-11-30 14:30:15 -08:00

53 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../lib/common.sh"
log_info "Updating XDM configuration"
if ! is_linux; then
log_error "XDM is only available on Linux"
exit 1
fi
# Determine XDM config directory based on distro
if [ -d "/etc/X11/xdm" ]; then
XDM_DIR="/etc/X11/xdm"
elif [ -d "/etc/xdm" ]; then
XDM_DIR="/etc/xdm"
else
log_error "XDM config directory not found"
log_info "Expected /etc/X11/xdm or /etc/xdm"
exit 1
fi
CONFIG_SOURCE="$SCRIPT_DIR/../config/xdm"
if [ ! -d "$CONFIG_SOURCE" ]; then
log_error "Source XDM config not found at $CONFIG_SOURCE"
exit 1
fi
log_info "Copying XDM configuration from $CONFIG_SOURCE to $XDM_DIR"
# Copy files
for file in Xresources Xsetup Xstartup; do
if [ -f "$CONFIG_SOURCE/$file" ]; then
log_info "Copying $file"
maybe_sudo cp "$CONFIG_SOURCE/$file" "$XDM_DIR/$file"
# Make scripts executable
if [ "$file" = "Xsetup" ] || [ "$file" = "Xstartup" ]; then
maybe_sudo chmod +x "$XDM_DIR/$file"
fi
else
log_warn "$file not found in $CONFIG_SOURCE"
fi
done
log_success "XDM configuration updated"
log_info ""
log_info "To apply changes, restart XDM:"
log_info " sudo systemctl restart xdm"