Search Members Help

» Welcome Guest
[ Log In :: Register ]

Mini-ITX Boards Sale, Fanless BareBones Mini-ITX, Bootable 1G DSL USBs, 533MHz Fanless PC <-- SALE $200 each!
Get The Official Damn Small Linux Book. DSL Market , Great VPS hosting provided by Tektonic
Pages: (4) </ 1 2 3 4 >/

[ Track this topic :: Email this topic :: Print this topic ]

reply to topic new topic new poll
Topic: Startup Configs, bootlocal, bash_profile, etc.< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Aug. 04 2005,02:47 QUOTE

Just About Anything Can Be Triggered With A Boot Option

Everything you enter at the boot prompt or through the bootloader is stored in a file called /proc/cmdline.  What this means for the user is that anything can be given at boot, regardless of whether it's built into DSL's boot scripts, and later be called up to trigger a command.  This is very handy if you want something done during the boot process which isn't a standard part of DSL.  A keyword can be entered at boot, and when /opt/bootlocal.sh runs just before login it could be scripted to search for that keyword, and react accordingly.

Here's a simple example....
Say you want to automatically run syslogd, but not necessary every time you boot up.  You could add the word "log" to your boot string, and then have /opt/bootlocal.sh check for that word:

Code Sample
if egrep -q " log" /proc/cmdline 2>/dev/null; then
chmod 644 /var/log/messages
syslogd
fi

The "chmod" command is optional...it just makes messages readable by regular users.

There are a couple of ways to set up boot options, and the file /etc/init.d/dsl-functions provides easy access to these methods.
You can check for a simple one-word boot option with the above egrep, or if you source dsl-functions in whatever script you use you can do it with "checkbootparam word", and you can check for a "word=something" with "getbootparam word" (getbootparam returns "something").


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
Deranged Offline





Group: Members
Posts: 6
Joined: Aug. 2005
Posted: Aug. 29 2005,18:05 QUOTE

Thanks. .bash_profile was what I was looking for, Now it logins how I want it. Thanks!
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Sep. 19 2005,02:29 QUOTE

Pick One Of Several Window Managers To Start

There are several ways to specify which window manager to use when you start an X session.  Here are a few methods:

1) Edit $HOME/.xinitrc every time before running startx (not an appealing method).

2) Write an xinitrc file for each window manager (.xinitrc.twm, .xinitrc.fluxbox, etc.) and symlink .xinitrc to the one you want to run at a given time.  For example, if you want to start twm with this setup you could use something like this to start it:
Code Sample
ln -sf .xinitrc.twm .xinitrc && startx
This overwrites the current .xinitrc with a link to .xinitrc.twm. The startx command runs as usual,and xinit uses .xinitrc.twm as its config file.

3) Set up .xinitrc to start a window manager according to a parameter sent along with the startx command.  This apparently doesn't work with DSL's startx, so i won't go into how to do this.

4) Set up .xinitrc to start a window manager according to an environment variable.  You would need to export a variable ("wm", for example) with a keyword associated with a particular window manager, and then startx:
Code Sample
export wm=evilwm && startx
or
Code Sample
wm=evil startx

and .xinitrc would be set up to look for this variable before running the window manager. The following is from my current .xinitrc file, which works with the above command, and also works by using "wm=evil" in the bootloader's options.
Code Sample
CMDLINE=`cat /proc/cmdline`
. /etc/init.d/dsl-functions

if [ -n "$wm" ]; then
WINDOWMANAGER="$wm"
else
WINDOWMANAGER=`getbootparam wm`
fi

case $WINDOWMANAGER in
evil*)
root-tail --noinitial --font snap -f --color red4 --whole --cont ........ --cont-color black -g 512x384+4+0 \
${HOME}/WM.log,red4,'general' \
/var/log/messages,orange4,'messages' &
bsetbg -f $HOME/.fluxbox/backgrounds/thinklinux1024.jpg
WM=/opt/evilwm/evilwm
;;
wmi*)
WM=/opt/wmii/bin/wmii
;;
*dev|*devel)
WM=/opt/fluxbox_0.9.14/bin/fluxbox
wmix &>/dev/null &
monto &>/dev/null &
;;
*)
WM=fluxbox
wmix &>/dev/null &
monto &>/dev/null &
;;
esac

exec $WM &>$HOME/WM.log


EDIT: forgot to add the "CMDLINE" variable for getbootparam


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Sep. 19 2005,03:12 QUOTE

Use A Persitent Home And/Or Opt On The Same Partition As Root In Frugal

The current DSL init process fails to accept the 'home=' and 'opt=' boot options using the same partition as the KNOPPIX file system unless you use toram and frugal as well.  Personally I prefer not to use toram, particularly when working with multimedia applications. So I've come up with a workaround.

NOTE: This procedure runs from bootlocal, so it overwrites any home and opt files automatically restored from mydsl or backup.tar.gz.  Do not use it if you autoload other files to home and opt.

Step 1: Create /home/dsl and /opt directories on the partition containing KNOPPIX.  These directories should not initially be empty, or you'll lose a lot of functionality. What I did was copy the directories from my DSL ramdisk.

Step 2: Edit /opt/bootlocal.sh and back it up.  You can back it up using the backup/restore process, or create a myDSL extension for this file.  In addition to whatever other commands you want to run from bootlocal, you should also have the following:
Code Sample
rm -rf /{,ramdisk/}{home,opt}
mkdir /{home,opt}
mount --bind /cdrom/home /home
mount --bind /cdrom/opt /opt

What this will do is:
a) Remove /ramdisk/home, /ramdisk/opt, and the symlinks to these directories.
b) Create mountpoints for home and opt.
c) Mount the new home and opt.
If you want to do *only* home, it would look more like this:
Code Sample
rm -rf /{,ramdisk/}home
mkdir /home
mount --bind /cdrom/home /home

This assumes that /cdrom is the location of the frugal install.  I'm guessing that this is a standard location, but one should never assume =o)  You probably should make sure of the location of KNOPPIX as seen from within DSL before doing this.

Step 3: Reboot using the "frugal" boot option, and pointing either "mydsl=" or "restore=" to the location of your backup or mydsl extension containing the new bootlocal.  The frugal boot option is vital, since you will need to be able to write to /cdrom.

EDIT:  If you are anything like me you probably do a lot of editing and re-editing of files, and if bootlocal.sh is one of these files you may find it annoying to have to create a backup or mydsl package every time you make a change to bootlocal.sh...particularly when you have a persistent opt that would normally make it very simple to make and keep changes.  A way around this is to create a bootlocal.sh containing only the code above, followed by a command to run a second script (e.g. "exec /opt/bootlocal2.sh").  This way you can have all your other bootlocal stuff in an uncompressed, persistent script, making it easy to edit and forget it.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
doobit Offline





Group: Members
Posts: 912
Joined: July 2005
Posted: Oct. 05 2005,18:38 QUOTE

Here's the official (I think it is anyway) Linux boot options link:

http://www.faqs.org/docs/Linux-HOWTO/BootPrompt-HOWTO.html


--------------
"Help stop internet piracy...use Linux!"
Back to top
Profile PM WEB MSN 
18 replies since Aug. 03 2005,18:47 < Next Oldest | Next Newest >

[ Track this topic :: Email this topic :: Print this topic ]

Pages: (4) </ 1 2 3 4 >/
reply to topic new topic new poll
Quick Reply: Startup Configs

Do you wish to enable your signature for this post?
Do you wish to enable emoticons for this post?
Track this topic
View All Emoticons
View iB Code