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: (2) </ [1] 2 >/

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

reply to topic new topic new poll
Topic: specify subdirectory for mydsl apps, in boot string< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: May 20 2005,22:18 QUOTE

So clivesay got me thinking about yet another possibility, and i had to try it out...

You can presently specify a partition to have a collection of myDSL apps automatically load on boot (mydsl=<partition>), so you can have a variety of DSL configurations using a single liveCD or frugal install.  However, the number of variants is currently limited by the number of partitions you have, using the "mydsl=" boot option.

Fortunately, DSL has been configured to save your boot options so that you can use them at any time (sweeeet!).  So here's a way to provide numerous mydsl combinations chosen at boot, with only a single partition, or with no partitions by using a rebuilt CD.

By including a special bit of script in /opt/bootlocal.sh, you can specify on the boot line a path to where mydsl applications are stored.  For example:
mydsldir=hda1/myDSL/xfree
Using this boot option, the mydsl apps in /mnt/hda1/myDSL/xfree will be loaded from bootlocal.sh
If you want multiple configs using some of the same applications, symlinks put in the subdirectories will work just as well as copies, so you can save some space.

Here's what I put in /opt/bootlocal.sh:
Code Sample

. /etc/init.d/dsl-functions
CMDLINE="$(cat /proc/cmdline)"

getmydsl() {
for FILE in `ls $1/* 2>/dev/null`; do
case $FILE in
*.tar.gz)
BASE=$(getbasefile "$FILE" 2)
if [ "$BASE" != "backup" ]; then
echo "${YELLOW}$BASE${NORMAL}"
sudo su dsl -c mydsl-load $FILE
fi
;;
*.dsl|*.uci)
BASE=$(getbasefile "$FILE" 1)
echo "${YELLOW}$BASE${NORMAL}"
sudo su dsl -c mydsl-load $FILE
;;
esac
done
}

MYDSL="$(getbootparam 'mydsldir')"
if [ -n "$MYDSL" ]; then
DEVICE="${MYDSL%%/*}"
MOUNTED=`grep "/dev/$DEVICE" /etc/mtab 2>/dev/null`
if [ -n "$MOUNTED" ]; then
DIR="/cdrom/${MYDSL#*/}"
else
DIR="/mnt/$DEVICE/${MYDSL#*/}"
mount /dev/$DEVICE &>/dev/null
fi
if [ -d "$DIR" ]; then
     getmydsl "$DIR"
fi
fi

It's loosely based on Robert's getmydslapps function in dsl-config

There are some minor issues i need to fix...

It wasn't working with the partition containing KNOPPIX, because it was already mounted.  The code i added to address this is sloppy and probably unreliable, but it does seem to work as long as you haven't booted toram and mounted that drive from bootlocal.  I'll have to work out a better solution.

It hasn't been tested from a rebuilt iso including the mydsl directories, but i'm thinking it should work the same.  Using "mydsldir=cdrom/path/to/files" *should* end up using /cdrom.

This doesn't apply to mydsl apps in /cdrom/optional...you'd still need to use mydsl=whatever to get those.


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





Group: Members
Posts: 146
Joined: Sep. 2004
Posted: May 21 2005,11:38 QUOTE

Really interesting idea - would be handy to be able to point the mydsl boot option at a specific directory path.

--------------
"We don't need no stinkin' Windows"

http://news.zdnet.co.uk/software/linuxunix/0,39020390,39149796,00.htm
Back to top
Profile PM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: May 21 2005,14:00 QUOTE

Tiny bit more info....

While playing around with it a bit more, i realized what am i gonna do if i need boottime commands specific to one setup?  If you have only one bootlocal.sh for all systems, the file has to be built to accomodate all...
Code Sample

if [ "${MYDSL##*/}" = "xfree" ]; then
do some commands for xfree only
fi

"xfree" is the name of the directory containing the applications related to an XFree86 setup.  If "mydsldir=<partition>/path/to/xfree" was used on the boot line, that piece of code will be run.

Another option...
If you are always going to use the same device and base directory, that can be specified in the script, so all you'd need to put on the boot line is "mydsldir=xfree".
I haven't done anything with that yet, but it will probably end up being a part of the final script.


--------------
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: May 21 2005,18:00 QUOTE

Updated the script to do both things mentioned in the previous post.
mydsldir_boot_option.txt


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





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: May 21 2005,21:32 QUOTE

This really should not be done in /opt/bootlocal.sh as it is after the restore.
This out of order procedure prevents persisting any data certain apps may require.

It is also unforunate that I too was ask to look at this, and I have it implemented for the next release. where is belongs in the proper order.

I suppose that is why when you, mikshaw, asked me such pointed questions regarding string chopping in IRC i was quick to answer you, little did I know that this is what your efforts were focused on. It is also too bad that you did not communicate with me about this. Anyway, I am sure that you had fun thinking about how this stuff works.

Again, I would not recommend running this procedure from /opt/bootlocal.sh
It belongs before the restore of data thus allowing persistancy of config files. etc.
Back to top
Profile PM WEB 
5 replies since May 20 2005,22:18 < Next Oldest | Next Newest >

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

Pages: (2) </ [1] 2 >/
reply to topic new topic new poll
Quick Reply: specify subdirectory for mydsl apps

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