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

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

reply to topic new topic new poll
Topic: Script help needed please< Next Oldest | Next Newest >
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Dec. 28 2004,20:27 QUOTE

ok...well I wrote a different one in the meantime.  This was tested on an unmodified DSL 0.9.1:
Code Sample

#!/bin/sh

MNTPNT=/mnt/hda5  # mount point
DOCDIR="$MNTPNT/MyDocuments"  # name of linked directory
# name of the link will be generated from DOCDIR basename

mount_fail() {
echo "$MNTPNT failure - exiting"
exit 1
}
mount $MNTPNT && echo "$MNTPNT mounted" || mount_fail
[ -d "$DOCDIR" ] || mkdir -p "$DOCDIR"
ln -s "$DOCDIR" "$HOME/`basename $DOCDIR`"

The difference is basically that the link name is automatically generated depending on the name of the target directory, and it exits if the mount fails.
It still doesn't account for failure to write to the target partition.


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





Group: Guests
Posts: 935
Joined: Dec. 2003
Posted: Dec. 28 2004,20:33 QUOTE

I just tested your second script at boot and it appears that it is not creating the link if MyDocuments already exists on hda5. I want it create the link if it finds /mnt/hda5/MyDocuments.

The idea is that the first time I boot after doing a frugal install, it sees there is not a MyDocuments folder on hda5 so it creates one and then links it. On every boot after that, I just want it to create the link to the now existing /mnt/hda5/MyDocuments dir.

I hope this makes sense

Chris
Back to top
Profile PM MSN YIM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Dec. 28 2004,20:37 QUOTE

Alright...I made a slight modification.  If the directory doesn't exist it is created.  The ln command is run either way.  My syntax was wrong....i thought it would link either way, but I guess not.

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





Group: Guests
Posts: 935
Joined: Dec. 2003
Posted: Dec. 28 2004,20:56 QUOTE

mikshaw -

We are getting close. It appears the third script ran OK but it placed the symlink in the root dir instead of /home/dsl

Chris
Back to top
Profile PM MSN YIM 
mikshaw Offline





Group: Members
Posts: 4856
Joined: July 2004
Posted: Dec. 28 2004,21:54 QUOTE

well that's weird.... "$HOME/`basename $DOCDIR`" should be /home/dsl/MyDocuments.  It's not really necessary to do that...I just thought it would be easier in case you wanted to change the directory.  Until I get back to it you could change the last line to
ln -s "$DOCDIR" /home/dsl/MyDocuments
or use the other script.

by the way, is it "MyDocuments" or "My Documents"?  A space in there might screw things up.


--------------
http://www.tldp.org/LDP/intro-linux/html/index.html
Back to top
Profile PM WEB 
12 replies since Dec. 28 2004,16:02 < Next Oldest | Next Newest >

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

Pages: (3) </ 1 [2] 3 >/
reply to topic new topic new poll
Quick Reply: Script help needed please

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