Update: Nicer rc scripts

John S. Skogtvedt jss2k2 at chello.no
Mon Apr 16 21:59:34 CEST 2007


Benjamin Tomos Lewis skrev:

---
-# create /etc/passwd if it doesn't exist
+# Create /etc/passwd if needed
---

A bit nitpicky, but are such cosmetic changes really necessary?


---
 # start telnetd if configured
@@ -45,10 +59,13 @@
 	then
 		/etc/rc.d/telnetd start
 	else
-		echo "Not starting telnetd: network is down"
+		echo "Starting telnetd..."
+		rchelper $?
+		echo " Network down."
 	fi
 fi

+
---

This doesn't look right. And what was wrong with the original message?



---
+echo "Mounting /media..."
+echo " Trying vfat on SD card..."
+mount -t vfat -o noatime /dev/mmcblk1 /media ; rchelper $?
+
 if [ "$?" != "0" ]
 then
-	mount -t vfat -o noatime /dev/hda1 /media
+	echo " Trying vfat on SD card, no partition table..."
+	mount -t vfat -o noatime /dev/mmcblk0 /media ; rchelper $?
+
 	if [ "$?" != "0" ]
 	then
-		# some CF cards do not have a partition table
-		# try mounting /dev/hda
-		mount -t vfat -o noatime /dev/hda /media
+		echo " Trying vfat on CF card..."
+		mount -t vfat -o noatime /dev/hda1 /media ; rchelper $?
+		
 		if [ "$?" != "0" ]

---


Here $? gets overwritten when you run rchelper. Either change rchelper
to return the same code that it's given, or store the value of $? before
running rchelper.




More information about the dslinux-devel mailing list