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
 

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

reply to topic new topic new poll
Topic: dsl-functions, A couple of suggestions< Next Oldest | Next Newest >
friedgold Offline





Group: Members
Posts: 122
Joined: Mar. 2005
Posted: Oct. 04 2005,17:49 QUOTE

The following patch fixes a couple of minor annoyances with /etc/init.d/dsl-functions:

* find_mountpoint greps mtab and fstab to find where the mountpoint for a given device should be. If the fstab contains two lines like these:

Code Sample
#/dev/hda1 /some/mountpoint ...
/dev/hda1 /some/other/mountpoint ...


then find_mountpoint will return both mountpoints when it should just return the uncommented one. This can be fixed by using ^ in the regular expression to match from beginning of the line.

* Send output of mount/umount commands to /dev/null when autoscaning for backup.tar.gz. This prevents the following error messages being shown on bootup:

mount: no medium found
umount: /mnt/auto/cdrom is not mounted

Code Sample
--- ../original/dsl-1.5/source/etc/init.d/dsl-functions 2005-07-15 21:25:48.000000000 +0100
+++ source/etc/init.d/dsl-functions     2005-10-04 18:26:56.000000000 +0100
@@ -82,13 +82,13 @@
 MOUNTED="no"
 DEVICE="$1"
 D2="/dev/$DEVICE\>"
- MOUNTPOINT="$(grep -i $D2   /etc/mtab|awk '{print $2}')"
+ MOUNTPOINT="$(grep -i ^$D2   /etc/mtab|awk '{print $2}')"
 if [ -n "$MOUNTPOINT" ]; then
   MOUNTED="yes"
   return
 fi

- MOUNTPOINT="$(grep -i $D2   /etc/fstab|awk '{print $2}')"
+ MOUNTPOINT="$(grep -i ^$D2   /etc/fstab|awk '{print $2}')"
}

get_mountpoint() {
@@ -109,13 +109,13 @@
   get_mountpoint $DEVICE
   if [ -n "$MOUNTPOINT" ]; then
     if [ "$MOUNTED" == "no" ]; then
-       mount "$MOUNTPOINT"
+       mount "$MOUNTPOINT">/dev/null 2>&1
     fi
     if [ -f "$MOUNTPOINT"/$1 ]; then
       FOUND="yes"
     fi
     if [ "$MOUNTED" == "no" ]; then
-       umount "$MOUNTPOINT"
+       umount "$MOUNTPOINT">/dev/null 2>&1
     fi
     if [ -n "$FOUND" ]; then
       echo "$DEVICE"
Back to top
Profile PM 
roberts Offline





Group: Members
Posts: 4983
Joined: Oct. 2003
Posted: Oct. 04 2005,18:24 QUOTE

Thanks, friedgold. Agreed. Will be in next release.
Back to top
Profile PM WEB 
1 replies since Oct. 04 2005,17:49 < Next Oldest | Next Newest >

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

 
reply to topic new topic new poll
Quick Reply: dsl-functions

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