ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions

sparky cvs at pld-linux.org
Fri Mar 3 01:26:01 CET 2006


Author: sparky
Date: Fri Mar  3 01:26:00 2006
New Revision: 7072

Modified:
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions
Log:
- lastlink function rewritten
- nvopt function added


Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/functions	Fri Mar  3 01:26:00 2006
@@ -14,14 +14,13 @@
 lastlink() {
 	ll_dir="$(dirname "$1")"
 	ll_file="$(basename "$1")"
-	while [[ -n `resolvesymlink $ll_dir/$ll_file` ]]; do
-		ll_file="`resolvesymlink $ll_dir/$ll_file`"
-		if echo "$ll_file" | egrep -q "^/"; then
-			ll_dir="$(dirname "$ll_file")"
-			ll_file="$(basename "$ll_file")"
+	while link="`resolvesymlink $ll_dir/$ll_file`" && [[ -n $link ]]; do
+		if echo "$link" | egrep -q "^/"; then
+			ll_dir="$(dirname "$link")"
+			ll_file="$(basename "$link")"
 		else
-			ll_dir="$ll_dir/$(dirname "$ll_file" | sed 's/^\.//')"
-			ll_file="$(basename "$ll_file")"
+			ll_dir="$ll_dir/$(dirname "$link" | sed 's/^\.//')"
+			ll_file="$(basename "$link")"
 		fi
 	done
 	echo "$ll_dir/$ll_file" | sed -e 's_//*_/_g' -e 's_^\./__'
@@ -98,6 +97,13 @@
 }
 
 
+### nvopt: check for specified ppcrcd vars in nvram option ###################
+nvopt() {
+	nvsetenv ppcrcd | sed 's/^ppcrcd=//' | tr "[:blank:]" "\n" | \
+		egrep -iq "^$1$"
+	return $?
+}
+
 ### cmdvar: display specified or all kernel command line vars ################
 cmdvar() {
 	if [[ -n $1 ]]; then


More information about the pld-cvs-commit mailing list