ppcrcd/trunk: conf.dir/linuxrc conf.dir/usr/lib/ppcrcd/add-ppcrcd-to-nvram.sh conf.dir/usr/lib/ppcrc...

sparky cvs at pld-linux.org
Wed Mar 15 20:56:53 CET 2006


Author: sparky
Date: Wed Mar 15 20:56:43 2006
New Revision: 7174

Added:
   ppcrcd/trunk/doc/gendoc.pl   (contents, props changed)
Modified:
   ppcrcd/trunk/conf.dir/linuxrc
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/add-ppcrcd-to-nvram.sh
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/assemble
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/fbsplash
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/load-conf
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/memtest
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/net-detect
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/rc.live
   ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/xmltar.pl
   ppcrcd/trunk/initrd.dir/linuxrc
Log:
- prepare some documentation automation


Modified: ppcrcd/trunk/conf.dir/linuxrc
==============================================================================
--- ppcrcd/trunk/conf.dir/linuxrc	(original)
+++ ppcrcd/trunk/conf.dir/linuxrc	Wed Mar 15 20:56:43 2006
@@ -31,7 +31,7 @@
 cp -a /live/dev /dev
 chmod -R +w /dev
 
-# is it still neaded ?
+# is it still needed ?
 touch /fastboot
 
 # put / in mtab

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/add-ppcrcd-to-nvram.sh
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/add-ppcrcd-to-nvram.sh	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/add-ppcrcd-to-nvram.sh	Wed Mar 15 20:56:43 2006
@@ -27,7 +27,7 @@
 	die 99 "aborted"
 }
 
-# if something fails
+# if something fails restore old nvram image
 undo_die() {
 	echo "$2" > /dev/stderr
 	

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/assemble
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/assemble	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/assemble	Wed Mar 15 20:56:43 2006
@@ -1,9 +1,11 @@
 #!/bin/sh
 DEV=$1
 
+# be sure md is not being assembled right now
 if ps aux | grep mdadm | grep -q $DEV; then
 	exec /bin/true
 else
+	# check if already assembled
 	if /sbin/mdadm --misc -D $DEV >/dev/null 2>&1; then
 		exec /bin/true
 	else

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/fbsplash
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/fbsplash	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/fbsplash	Wed Mar 15 20:56:43 2006
@@ -4,6 +4,7 @@
 
 [ -x /sbin/splash_util ] || exit
 
+#@@ nosplash:	disable fbsplash
 cmdopt nosplash && exit
 
 verbose 1 -G "Trying to start fbsplash"

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/hw-detect	Wed Mar 15 20:56:43 2006
@@ -48,7 +48,8 @@
 done
 
 # Searching for partitions ###################################################
+#@@ nomd:	don't try to autodetect md partitions
 cmdopt nomd || \
-	PARTS=$(/usr/lib/ppcrcd/find_md $(< /verbose) | sort)
+	/usr/lib/ppcrcd/find_md $(< /verbose) > /dev/null 2>&1
 
 # vi: ts=4:sw=4

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/load-conf
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/load-conf	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/load-conf	Wed Mar 15 20:56:43 2006
@@ -4,6 +4,21 @@
 
 . /usr/lib/ppcrcd/functions
 
+#@nv@ conf: syntax:
+#@		| conf=<device>[:<modules>[:<fs>[:<file>]]]
+#@		Load configuration from <device>, from <file> (if it isn't
+#@		ppcrcd.xml.gz).
+#@		First loads coma separated kernel modules (if needed for device)
+#@		and mounts partition as <fs> filesystem (needed if can't be
+#@		autodetected). <modules>, <fs> and <file> may be blank.
+#@		Examples:
+#@		config on /dev/hda5 (pmac-ide) in /conf2.gz file
+#@		| 	conf=/dev/hda5:::conf2.gz
+#@		config on /dev/hda2 with hfsplus fs in (standart) ppcrcd.xml.gz file
+#@		| 	conf=/dev/hda5::hfsplus
+#@		config on usb-storage, vfat
+#@		| 	conf=/dev/sda1:usb-storage,sd_mod,ohci-hcd:vfat:ppc1.gz
+#@@ nonvconf:	don't load config specified in nvram
 conf=$(cmdvar conf | head -n1)
 if [ -z "$conf" ]; then
 	cmdopt nonvconf || conf=$(nvvar conf)

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/memtest
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/memtest	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/memtest	Wed Mar 15 20:56:43 2006
@@ -10,6 +10,8 @@
 /bin/umount /initrd
 /sbin/blockdev --flushbufs /dev/ram0
 
+#@memtest@	modpre=<module1>[,<module2>[,<module3>[...]]]:
+#@				load specified modules
 for MOD in $(cat /proc/cmdline | tr "[:blank:]" "\n" | egrep "^(module|modpre)=" | \
 	sed "s/^[a-z]*=//" | tr "," " "); do
 	echo "Loading module: $MOD"

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/net-detect
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/net-detect	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/net-detect	Wed Mar 15 20:56:43 2006
@@ -74,7 +74,18 @@
 	done
 }
 
-
+#@nv@ eth:
+#@	syntax:
+#@	| eth=<module>:<ip/mask>[:<gate>[:<dns1>[,<dns2>[,...]]]]
+#@	Configure ethernet for ethernet card supported by <module>.
+#@	Note: this option may be buggy with autodetection in udev enabled.
+#@	Multiple eth options are allowed. 
+#@	IP/mask can be one of: 192.168.0.2/24, dhcp or pump.
+#@	Last eth with gate specified will become default route.
+#@	All dns of each eth will be added to '/etc/resolv.conf'.
+#@	Example:
+#@	| eth=sungem:192.168.0.5/24:192.168.0.2:192.168.0.2
+#@@ nonveth: don't configure ethernet specified in nvram
 ETHS=$(cmdvar eth)
 if [ -n "$ETHS" ]; then
 	verbose 2 -B " +-Using cmdline network config"

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/rc.live
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/rc.live	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/rc.live	Wed Mar 15 20:56:43 2006
@@ -9,6 +9,7 @@
 
 setterm -msg off
 
+#@@ noauto:	disable udev automation
 cmdopt noauto && mv -f /etc/udev/rules.d{,.noauto}
 
 if ! [ -d /dev/input ]; then
@@ -16,6 +17,12 @@
 	/sbin/start_udev
 fi
 
+#@nv@ modpre:
+#@	syntax:
+#@	| modpre=<module1>[,<module2>[,<module3>[...]]]
+#@	Loads modules just after udev start, before debug shell. Ex.:
+#@	| modpre=usbhid,ohci-hcd			
+#@@ nonvmodpre: don't load modules specified in nvram modpre option
 modpre=$(cmdvar "modpre")
 if [ -z "$modpre" ]; then
 	cmdopt nonvmodpre || modpre=$(nvvar modpre)
@@ -28,6 +35,9 @@
 
 [ -x /usr/lib/ppcrcd/fbsplash ] && /usr/lib/ppcrcd/fbsplash
 
+#@@	debug:
+#@	put debugging information (set -x),
+#@	and runs sh at startup to allow do something	
 DEBUG=0
 if cmdopt debug; then
 	export DEBUG=1
@@ -44,6 +54,9 @@
 	rm -rf /initrd
 fi
 
+#@@ verbose: be more verbose
+#@	| verbose=<L>
+#@	Sets verbosity level to <L>, (min 0, max 5). Without <L> specified it's 0.
 cmdopt verbose && echo 1 > /verbose
 verb=$(cmdvar verbose)
 [ -n "$verb" ] && echo $verb > /verbose || echo 0 > /verbose
@@ -54,6 +67,9 @@
 CONF_LOADED=$?
 
 ### swap #####################################################################
+#@nv@	swap:	enable autodetected swap partition(s)
+#@nv@	swap=<dev1>,<dev2>:	enable swap partition(s) on specified devices
+#@@ nonvswap:	don't enable swap partitions even if specified in nvram
 if cmdopt swap || { ! cmdopt nonvswap && nvopt swap; }; then
 	swap=$(cmdvar "swap")
 	if [ -z "$swap" ]; then
@@ -71,16 +87,24 @@
 
 
 ### hw/net-detect ############################################################
+#@@ nodetect:	Don't try to autodetect hardware.
+#@				(does not affect udevs autodetection)
 cmdopt nodetect || ( \
 	[ "$CONF_LOADED" -ne 0 ] && \
 		sh $SHD /usr/lib/ppcrcd/hw-detect )
 		
 sh $SHD /usr/lib/ppcrcd/net-detect
 
+#@@ nonet:  Don't start network services at boot time.
+#@			Changes ONBOOT value to "no" in ifcfg-* scripts
 cmdopt nonet && \
 	sed -i -e 's/ONBOOT=.*/ONBOOT=no/' /etc/sysconfig/interfaces/ifcfg-*
 
 ### modules ##################################################################
+#@nv@	modules=<module1>[,<module2>[,<module3>[...]]]:
+#@		Adds module(s) to /etc/modules. Ex.:
+#@		| modules=therm_adt746x
+#@@ 	nonvmodules:	don't use nvram modules option
 modules=$(cmdvar "modules")
 if [ -z "$modules" ]; then
 	cmdopt nonvmodules || modules=$(nvvar modules)
@@ -94,6 +118,10 @@
 
 
 ### keytable #################################################################
+#@nv@	keytable=<name>:
+#@		Preset system keytable. Ex., spanish keytable:
+#@		| keytable=es
+#@@ nonvkeytable: Don't setup key table using nvram informations.
 keytable=$(cmdvar "k(ey){0,1}(map|tab.*)")
 if [ -z "$keytable" ]; then
 	cmdopt nonvkeytable || keytable=$(nvvar "k(ey){0,1}(map|tab.*)")
@@ -113,6 +141,9 @@
 
 
 ### services #################################################################
+#@nv@	service=<service1>[,<service2>[,<service3>]]
+#@			start service(s) at system startup
+#@@ nonvservice:	Don't start services specified in nvram
 serv=$(cmdvar service)
 if [ -z "$serv" ]; then
 	cmdopt nonvservice || serv=$(nvvar service)

Modified: ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/xmltar.pl
==============================================================================
--- ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/xmltar.pl	(original)
+++ ppcrcd/trunk/conf.dir/usr/lib/ppcrcd/xmltar.pl	Wed Mar 15 20:56:43 2006
@@ -87,6 +87,7 @@
 	}
 	print $step."<!--F $localdir".lastname($file)." {{{$level -->\n" if $comment;
 	print $step.'<xmltar:file mode="';
+	#TODO: use /proc/sys/kernel/random/uuid
 	printf "%04o",  ((stat $file)[2]) & 07777;
 	print '" name="'.lastname($file)."\">\n";
 	while ( <F_IN> ) {

Added: ppcrcd/trunk/doc/gendoc.pl
==============================================================================
--- (empty file)
+++ ppcrcd/trunk/doc/gendoc.pl	Wed Mar 15 20:56:43 2006
@@ -0,0 +1,73 @@
+#!/usr/bin/perl
+#
+use strict;
+use warnings;
+use File::Find;
+
+my %options;
+
+sub html {
+	$_ = $_[0];
+	s/&/&amp;/g;
+	s/</&lt;/g;
+	s/>/&gt;/g;
+	s#&lt;_&lt;(.*?)&gt;_&gt;#<u>$1</u>#gs;
+	s#&lt;\*&lt;(.*?)&gt;\*&gt;#<b>$1</b>#gs;
+	s#&lt;/&lt;(.*?)&gt;/&gt;#<i>$1</i>#gs;
+	return $_;
+}
+
+find(\&addoption, qw(initrd.dir conf.dir));
+sub addoption {
+	return if (!-f || -l || /^\./ || /~$/);
+	my $file = $_;
+	open F_IN, $_ or warn "$File::Find::name: $!\n" and return;
+	file: while ( <F_IN> ) {
+		if ( s/^\s*?#@([a-z]*)@\s+(.*?)\s*:\s+// ) {
+			$options{$1} = {} unless exists $options{$1};
+			my $hash = $options{$1};
+			my $varname = $2;
+			$hash->{$varname} .= $_;
+			while ( <F_IN> ) {
+				if ( s/^\s*?#@\s+// ) {
+					$hash->{$varname} .= $_;
+				} else {
+					redo file;
+				}
+			}
+		}
+	}
+	close F_IN;
+}
+
+sub htmlize {
+	my $pre = 0;
+	my $out = "";
+	foreach my $line ( split /\n/, html($_[0]) ) {
+		if ( $line =~ s/^\|\s// ) {
+			unless ( $pre ) {
+				$pre = 1;
+				$out .= "<pre>";
+			}
+		} else {
+			if ( $pre ) {
+				$pre = 0;
+				$out .= "</pre>\n";
+			}
+		}
+		$out .= $line . "\n";
+	}
+	return $out;
+}
+
+foreach my $opt (keys %options) {
+	print "<h1> $opt </h1>\n";
+	
+	foreach my $var (sort keys %{$options{$opt}}) {
+		print "<div>\n<h3>";
+		print html($var).":</h3>\n";
+		print htmlize($options{$opt}->{$var});
+		print "</div>\n";
+	}
+}
+# vim: ts=4:sw=4

Modified: ppcrcd/trunk/initrd.dir/linuxrc
==============================================================================
--- ppcrcd/trunk/initrd.dir/linuxrc	(original)
+++ ppcrcd/trunk/initrd.dir/linuxrc	Wed Mar 15 20:56:43 2006
@@ -6,6 +6,7 @@
 B="$P/bin"
 
 $B/mount -n -t proc proc /proc
+#@initrd@ debug:	put debugging information (set -x)
 $B/awk '/debug/ { exit 0 }; { exit 1 }' /proc/cmdline && set -x
 
 esc=''
@@ -109,6 +110,8 @@
 }
 
 ### MEMTEST #####################################
+#@bootoption@	memtest:
+#@		enter memtest mode
 if $B/awk '/memtest/ { exit 0 }; { exit 1 }' /proc/cmdline; then
 	$B/echo "${cY}***** Preparing memtest *****${cE}"
 	
@@ -147,6 +150,8 @@
 findcd
 
 # prepare loop and mount
+#@bootoption@ tomempost:
+#@		load image to ram
 if $B/awk "/tomempost/ { exit 0 }; { exit 1 }" /proc/cmdline; then
 	$B/echo "${cG}*** Copying ppcrcd.sqf image${cE}"
 	$B/cat /media/ppcrcd/ppcrcd.sqf > /ppcrcd.sqf
@@ -185,7 +190,7 @@
 fi
 /bin/mount -f /
 
-# stop ?
+#@initrd@ stop: runs shell at end of initrd script
 $B/awk "/stop/ { exit 0 }; { exit 1 }" /proc/cmdline && error "stop requested"
 $B/umount /proc
 #/bin/umount /initrd


More information about the pld-cvs-commit mailing list