Docking and Undocking
I maintain two simple shell scripts to switch between my docked and
my undocked configurations. When my laptop is docked it drives an
external monitor at 1280x1024x24bpp resolution. The undocked resolution
of the internal display is only 1024x768x24bpp, so the undock
script simply copies a new XF86Config file in place.
Your network configuration may also change depending on whether you are
docked or not. I maintain two sets of network configurations, one for
in work at HP, and another for at home. My IP address is statically
assigned in HP, but at home my Linksys router assigns a dynamic
IP address using DHCP.
Docked Configuration
To dock my laptop, I su - root and then run the
following script. The postfix mail daemon, and network services are
stopped and restarted after the IP address changes:
#!/bin/csh
# Switch to a config for docked at HP
#
/etc/init.d/postfix stop
/etc/init.d/network stop
cp /etc/X11/XF86Config.docked /etc/X11/XF86Config
cp /etc/sysconfig/network.hp /etc/sysconfig/network
cp /etc/sysconfig/network-scripts/hp /etc/sysconfig/network-scripts/ifcfg-eth0
cp /etc/resolv.conf.hp /etc/resolv.conf
cp /etc/postfix/main.cf.hp /etc/postfix/main.cf
/etc/init.d/network start
/etc/init.d/postfix start
Undocked Configuration
To undock my laptop in work, I su - root and then run the
following script:
#!/bin/csh
# Switch to an undocked HP configuration
#
/etc/init.d/postfix stop
/etc/init.d/network stop
cp /etc/X11/XF86Config.undocked /etc/X11/XF86Config
cp /etc/sysconfig/network.hp /etc/sysconfig/network
cp /etc/sysconfig/network-scripts/hp /etc/sysconfig/network-scripts/ifcfg-eth0
cp /etc/resolv.conf.hp /etc/resolv.conf
cp /etc/postfix/main.cf.hp /etc/postfix/main.cf
/etc/init.d/network start
/etc/init.d/postfix start
At home
To use my laptop at home I use the following script:
#!/bin/csh
# Switch to a config for Home
#
/etc/init.d/postfix stop
/etc/init.d/network stop
cp /etc/X11/XF86Config.laptop /etc/X11/XF86Config
cp /etc/sysconfig/network.athome /etc/sysconfig/network
cp /etc/sysconfig/network-scripts/athome /etc/sysconfig/network-scripts/ifcfg-eth0
cp /etc/resolv.conf.athome /etc/resolv.conf
cp /etc/postfix/main.cf.athome /etc/postfix/main.cf
/etc/init.d/network start
/etc/init.d/postfix start
where the /etc/sysconfig/network.athome file is:
NETWORKING=yes
FORWARD_IPV4=false
HOSTNAME=MYHOSTNAME.HERE.home.com
DOMAINNAME=MYDOMAIN.HERE.home.com
GATEWAY=192.168.1.1
GATEWAYDEV=eth0
and the /etc/sysconfig/network-scripts/athome file enables
the eth0 device to be configured at boot using DHCP from my Linksys
router box:
DEVICE=eth0
BOOTPROTO=dhcp
NETMASK=255.255.255.0
NETWORK=192.168.1.0
BROADCAST=192.168.1.255
ONBOOT=yes
|