#!/bin/sh usage() { echo "Enable/Disable Wayland in GDM" echo "Usage: sphere-wayland-configure <--enable|--disable>" echo exit 1 } OPTION="$1" echo $OPTION if [ "$OPTION" != "--disable" -a "$OPTION" != "--enable" ]; then echo "Unknown option" usage fi if [ ! -f /etc/gdm/custom.conf ]; then echo "GDM configuration file not found" exit 5 fi if [ "$OPTION" = "--enable" ]; then sed -i '/^WaylandEnable=false/s@^@#@' /etc/gdm/custom.conf sed -i '/^DefaultSession=/s@^@#@' /etc/gdm/custom.conf echo "Wayland enabled, please restart gdm" echo "sudo systemctl restart gdm.service" elif [ "$OPTION" = "--disable" ]; then sed -i '/^#WaylandEnable=false/s@^#@@' /etc/gdm/custom.conf sed -i '/^#DefaultSession=/s@^#@@' /etc/gdm/custom.conf echo "Wayland enabled, please restart gdm" echo "sudo systemctl restart gdm.service" fi