#! bash
#####################################################################
# Name: rs-gdm.sh Author: Nyle E. Davis #
# Created: 12/20/07 Modified: 12/21/07 #
# Purpose: Automation of gdm/xorg testing for various changes #
# in the xorg.conf file. #
# Mod: Added actions >> restore << and >> setup <<. #
# Files: xorg.conf current gdm/xorg config file. #
# xorg.conf.backup edited gdm/xorg config file. #
# xorg.conf.failsafe reversion gdm/xorg config file. #
# xorg.conf.old rev backup gdm/xorg config file. #
# Xorg.0.log gdm/xorg activity log file. #
# Xorg.0.log.backup gdm/xorg backup log file. #
# Actions: '' restore to the failsafe version. #
# 'setup' setup to run this script, without #
# restart, by making the copies of #
# the original files. #
# 'try' run the changes made to the edited #
# xorg.conf.backup file. #
# 'restore' after running the dpkg-reconfigure #
# and failing the test, restore to #
# previous config. #
#####################################################################
rc=0
ech_str=""
if test $# -lt 1
then
cp /var/log/Xorg.0.log /var/log/Xorg.0.log.backup
cp /etc/X11/xorg.conf.failsafe /etc/X11/xorg.conf
rc=1
ech_str="Running Restore to Failsafe"
elif test $1 = 'try'
then
cp /etc/X11/xorg.conf.backup /etc/X11/xorg.conf
rc=2
ech_str="Running Latest Edited Config version"
elif test $1 = 'restore'
then
cp /etc/X11/xorg.conf.old /etc/X11/xorg.conf.failsafe
cp /etc/X11/xorg.conf.failsafe /etc/X11/xorg.conf
rc=3
ech_str="Running Restore backup of Failsafe"
elif test $1 = 'setup'
then
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
cp /etc/X11/xorg.conf.failsafe /etc/X11/xorg.conf.old
ech_str="Running Setup and Copying files"
fi
echo $ech_str
if test $rc -gt 0
then
/etc/init.d/gdm restart
fi