Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Hi everyone,
I'd like to know if it's possible to run different commands at startup, choosing them through GRUB.
I mean, I'd like to have a GRUB entry like "Kubuntu - Normal Boot" and another one "Kubuntu - MythTV".
I'd like "Kubuntu - MythTV" not to launch kdm but just mythtv and another command, which I need to enable bluetooth remote controlling.
I thought I could set up a different runlevel to do so, but it seems a bit complicated.
Another option is to have a variable defined in the "kernel " line of the menu.lst stanza. I think I remember that options not recognized are defined in the environment of the INIT program. Scripts started subsequently may have that variable defined in their environment which could allow for conditional execution in scripts at boot time. I'm not 100% certain. I think there is a howto in the www.tldp.org website on grub or lilo that may verify this, but I wasn't able to find this info scanning the "kernel-parameters.txt" file in the kernel source.
Looks a bit too complicated, it hope there's something easiear to do...
Quote:
Originally Posted by jschiwal
Another option is to have a variable defined in the "kernel " line of the menu.lst stanza. I think I remember that options not recognized are defined in the environment of the INIT program. Scripts started subsequently may have that variable defined in their environment which could allow for conditional execution in scripts at boot time. I'm not 100% certain. I think there is a howto in the www.tldp.org website on grub or lilo that may verify this, but I wasn't able to find this info scanning the "kernel-parameters.txt" file in the kernel source.
It worked!
I added a new OS in /boot/grub/menu.lst with the 'elisa' parameter, then I put this script in /etc/init.d/ and made a symlink in /etc/rc2.d/ (Ubuntu's default runlevel)
Code:
#!/bin/bash
# This scripts checks /proc/cmdline and looks for the 'elisa' parameter
# If it's found, then it changes KDM's and X's config files to the needed options
# if not, it sets the default settings
#
# Author: Luca Zorzi < luca AT tutto e niente [WITHOUT-SPACES] [DOT] net >
# License: GNU/GPL v2
case "$1" in
start)
if [[ `grep elisa /proc/cmdline` != '' ]]
then
cd /etc/kde3/
tar xzf kdm.elisa.tar.gz
cp /etc/X11/xorg.conf.elisa /etc/X11/xorg.conf
touch /tmp/elisa
else
cd /etc/kde3/
tar xzf kdm.noelisa.tar.gz
cp /etc/X11/xorg.conf.elisa /etc/X11/xorg
touch /tmp/noelisa
fi
;;
*)
echo "Usage: /etc/init.d/$NAME {start}" >&2
exit 2
;;
esac
exit 0
I saved in /etc/X11/ 2 xorg.conf, with 2 different settings, with or without the TV enabled, and also tarred the KDM's config dir with and without the autologin for the elisa-only user.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.