coLinux
Advertisement

An additional script for dual-boot systems[]

If you're running coLinux on a dual-boot system, but still want to boot from the Linux partition occasionally, you need to manage your configuration somehow, since (especially if your networking is bridged) a lot of settings differ between coLinux-booting from it and directly-booting from it.

The idea is that you keep 2 versions of configuration files around, the ${conf_file}-colinux one (for coLinux) and ${conf_file}-non-colinux (your native Linux distribution). Before adding the script below, make a configuration specific copy of every configuration file.

If you use the naming conventions of the /etc/init.d/colinux script below, you do:

for conf_file in \
	"/etc/fstab" \
	"/etc/network/interfaces" \
	"/etc/X11/gdm/gdm.conf" \
	"/etc/hostname" \
	"/etc/mailname" \
	; do
	cp $conf_file $conf_file-colinux 
	cp $conf_file $conf_file-non-colinux
done

once.

I find the following script useful (link to it from /etc/rcS.d/ , after the root fs becomes writable, but before the rest of the local filesystems are mounted, on my system I have linked it to /etc/rcS.d/S11colinx.sh):

/etc/init.d/colinux[]

#
# colinux       use either a set of [[coLinux]]-related configuration
#               files, or their direct-boot counterparts
#
#

if [[ $COLINUX ]]; then
	SUFFIX=colinux
else
	SUFFIX=non-colinux
fi

for conf_file in \
	"/etc/fstab" \
	"/etc/network/interfaces" \
	"/etc/X11/gdm/gdm.conf" \
	"/etc/hostname" \
	"/etc/mailname" \
	; do
        # Instead of copying the file with:
        #    cp -f $conf_file-$SUFFIX $conf_file 
        # you can create a symbolic link.  This way, you will always edit the current
        # configuration file.
	ln -s -f $conf_file-$SUFFIX $conf_file 
done

# the COLINUX environment variable is not inherited much further
# than the init scripts, so if you want user processes to be able
# to tell whether we're in [[coLinux]] or stand-alone mode, you could
# do something like

# echo $COLINUX > /var/local/colinux

# or have the file's existence be the thing to check:

#if [[ $COLINUX ]]; then
#	touch /var/local/colinux
#else
#	rm -f /var/local/colinux
#fi


: exit 0

Obviously, you're asking yourself who sets the COLINUX environment variable. Well, you do! in your coLinux configuration file, have a bootprompt line such as the following:

<bootparams>root=/dev/cobd0 COLINUX=1</bootparams>

(you may have other parameters, you just need to set the COLINUX value).

Now, as for the settings files themselves - these will differ based on exactly what you're configuring, as well as difference between distributions. The example above is for Debian. You can apply this to as many configuration files as you want to have system specific, to avoid gdm from starting I also have /etc/X11/default-display-manager system specific (where the non-colinux version file is empty).

See also[]



Comments are welcome: eyalroz@technion.ac.il or fbreure@cox.net


MassTranslated on Sun Apr 23 17:36:03 UTC 2006

Advertisement