- Code: Select all
#!/sbin/runscript
# Jon Carrier
# To be placed in /etc/init.d/
# Run Command: rc-update add xdisplay boot
depend()
{
need localmount
before xdm-setup
before xdm
before alsasound
}
start()
{
cmdline_display_mode_exist=$(cat /proc/cmdline | grep "display=")
display_mode_dual_exist=$(ls /home/aether/conf/xorg/ | grep "xorg.conf.dual")
display_mode_single_exist=$(ls /home/aether/conf/xorg/ | grep "xorg.conf.single")
cmdline_display_mode=$(cat /proc/cmdline | awk -Fdisplay= '{print $2}' | awk '{print $1}')
if [ -n "$cmdline_display_mode_exist" ]; then
if [ -n "$display_mode_dual_exist" ] && [ -n "$display_mode_single_exist" ]; then
#Choose the xorg file to be copied over
if [ "$cmdline_display_mode" == "dual" ]; then
ebegin "Configuring X display in TwinView mode"
cp /home/aether/conf/xorg/xorg.conf.dual /etc/X11/xorg.conf
else
ebegin "Configuring X display in Standard mode"
cp /home/aether/conf/xorg/xorg.conf.single /etc/X11/xorg.conf
fi
sleep 5
eend 0
else
ebegin "Xorg file missing. Exitting"
eend 0
fi
fi
}
So here is what you will need to do to get this to work.
1. Make a file that contains the above code. I called this file "xdisplay"
2. Make two versions of your xorg.conf file; one for single display and one for dual display configuration. These should be named "xorg.conf.single" and "xorg.conf.dual" respectively. If you don't know how, best read up cause this isn't the topic of discussion.
3. Place these in some logical place on your local disk
4. Edit the file that contains the above code to point to those two files.
I.e. Replace all occurances of this path:
/home/aether/conf/xorg/
with the path where those two xorg.conf files are located
5. Now move this file (xdisplay) to the /etc/init.d/ directory
6. Add this to rc-update list. Use: rc-update add xdisplay boot
7. Open your grub menu in /boot/grub/menu.lst
8. Add two more sabayon sections. Just make two copies of your existing one that you normally boot from.
In one case you add the flag:
display=dual
In the other case you add the flag:
display=single
Technically it doesn't matter what you have after "display=" in this case as it default to single if dual is not satified
9. I suggest you keep your existing section you boot from as the default that way it only bothers copying the xorg files when you need to change modes.
Here is an example of my menu.lst after configuration
- Code: Select all
# grub.conf generated by the Sabayon Linux Installer
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,4)
# kernel /kernel-genkernel real_root=/dev/VolGroup00/LogVol00
# initrd /initramfs-genkernel
#boot=sda
default=0
timeout=30
splashimage=(hd0,4)/grub/splash.xpm.gz
title Sabayon Linux (genkernel-x86_64-2.6.27-sabayon) (music)
root (hd0,4)
kernel /kernel-genkernel-x86_64-2.6.27-sabayon music root=/dev/ram0 ramdisk=8192 real_root=/dev/VolGroup00/LogVol00 dolvm quiet init=/linuxrc splash=silent,theme:sabayon CONSOLE=/dev/tty1 vga=0x369 resume=swap:/dev/mapper/VolGroup00-LogVol01
initrd /initramfs-genkernel-x86_64-2.6.27-sabayon
title Sabayon Linux (genkernel-x86_64-2.6.27-sabayon) (verbose)
root (hd0,4)
kernel /kernel-genkernel-x86_64-2.6.27-sabayon root=/dev/ram0 ramdisk=8192 real_root=/dev/VolGroup00/LogVol00 dolvm quiet init=/linuxrc splash=verbose,theme:sabayon CONSOLE=/dev/tty1 vga=0x369 resume=swap:/dev/mapper/VolGroup00-LogVol01
initrd /initramfs-genkernel-x86_64-2.6.27-sabayon
title Sabayon Linux (genkernel-x86_64-2.6.27-sabayon) (verbose) (dual)
root (hd0,4)
kernel /kernel-genkernel-x86_64-2.6.27-sabayon display=dual root=/dev/ram0 ramdisk=8192 real_root=/dev/VolGroup00/LogVol00 dolvm quiet init=/linuxrc splash=verbose,theme:sabayon CONSOLE=/dev/tty1 vga=0x369 resume=swap:/dev/mapper/VolGroup00-LogVol01
initrd /initramfs-genkernel-x86_64-2.6.27-sabayon
title Sabayon Linux (genkernel-x86_64-2.6.27-sabayon) (verbose) (single)
root (hd0,4)
kernel /kernel-genkernel-x86_64-2.6.27-sabayon display=single root=/dev/ram0 ramdisk=8192 real_root=/dev/VolGroup00/LogVol00 dolvm quiet init=/linuxrc splash=verbose,theme:sabayon CONSOLE=/dev/tty1 vga=0x369 resume=swap:/dev/mapper/VolGroup00-LogVol01
initrd /initramfs-genkernel-x86_64-2.6.27-sabayon
title Sabayon Linux (genkernel-x86_64-2.6.27-sabayon) (safe mode)
root (hd0,4)
kernel /kernel-genkernel-x86_64-2.6.27-sabayon root=/dev/ram0 ramdisk=8192 real_root=/dev/VolGroup00/LogVol00 dolvm init=/linuxrc CONSOLE=/dev/tty1 resume=swap:/dev/mapper/VolGroup00-LogVol01 nox acpi=off ide=nodma vga=normal
initrd /initramfs-genkernel-x86_64-2.6.27-sabayon
title Microsoft Windows Vista Ultimate
rootnoverify (hd0,2)
makeactive
chainloader +1
title Dell Diagnostics
rootnoverify (hd0,0)
makeactive
chainloader +1
Hope this is useful to some. Enjoy
P.S. I am not an expert at init.d runscripts so if I did anything improperly please let me/us know.

