geninitrd/trunk/geninitrd

glen cvs at pld-linux.org
Fri May 26 10:42:49 CEST 2006


Author: glen
Date: Fri May 26 10:42:48 2006
New Revision: 7445

Modified:
   geninitrd/trunk/geninitrd
Log:
Use 'EOF' heredocs.

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Fri May 26 10:42:48 2006
@@ -1077,9 +1077,9 @@
 initrd_gen_suspend2() {
     	mkdir -p $MNTIMAGE/sys
     	mkdir -p $MNTIMAGE/proc
-cat << EOF >> "$s"
+cat << 'EOF' >> "$s"
 mount -t proc none /proc
-if [ "\$(awk ' /resume2=/  { print "yes"; } ' /proc/cmdline)" = "yes" ]; then
+if [ "$(awk ' /resume2=/  { print "yes"; } ' /proc/cmdline)" = "yes" ]; then
 EOF
 cat << EOF >> "$s"
 		echo > /proc/suspend2/do_resume
@@ -1198,45 +1198,45 @@
 }
 
 initrd_gen_nfs() {
-    	# use root=/dev/ram0 init=/linuxrc when starting kernel or you will
+	# use root=/dev/ram0 init=/linuxrc when starting kernel or you will
 	# have problems like init(XX) being child process of swapper(1).
-    	[ -n "$verbose" ] && echo "Adding rootfs on NFS support to initrd (dhcp)"
+	[ -n "$verbose" ] && echo "Adding rootfs on NFS support to initrd (dhcp)"
 	mknod "$MNTIMAGE/dev/urandom" c 1 8
 	mkdir "$MNTIMAGE/newroot"
 	mkdir "$MNTIMAGE/proc"
 	echo "ifconfig lo 127.0.0.1 up" >> "$s"
 	echo "route add -net 127.0.0.0 netmask 255.0.0.0 lo" >> "$s"
 	echo "ifconfig eth0 0.0.0.0 up" >> "$s"
-    	echo "udhcpc -i eth0 -f -q -s /bin/setdhcp"  >> "$s"
-	cat << EOF > "$MNTIMAGE/bin/setdhcp"
+	echo "udhcpc -i eth0 -f -q -s /bin/setdhcp"  >> "$s"
+	cat << 'EOF' > "$MNTIMAGE/bin/setdhcp"
 #!/bin/sh
-[ "\$1" != "bound" ] && exit
-[ -n "\$broadcast" ] && BROADCAST="broadcast \$broadcast"
-[ -n "\$subnet" ] && NETMASK="netmask \$subnet"
+[ "$1" != "bound" ] && exit
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+[ -n "$subnet" ] && NETMASK="netmask $subnet"
 set -x
-ifconfig \$interface \$ip \$BROADCAST \$NETMASK up
+ifconfig $interface $ip $BROADCAST $NETMASK up
 set +x
-if [ -n "\$router" ]; then
-    for r in \$router; do
+if [ -n "$router" ]; then
+    for r in $router; do
 	set -x
-	route add default gw \$r dev \$interface
+	route add default gw $r dev $interface
 	set +x
     done
 fi
 
 mount -t proc none /proc
-for o in \$(cat /proc/cmdline); do
-	case \$o in
+for o in $(cat /proc/cmdline); do
+	case $o in
 	nfsroot=*)
-		rootpath=\${o#nfsroot=}
+		rootpath=${o#nfsroot=}
 		;;
 	esac
 done
 umount /proc
 
-if [ -n "\$rootpath" ]; then
+if [ -n "$rootpath" ]; then
     set -x
-    mount -n -t nfs -o ro,nolock,posix,tcp,wsize=8192,rsize=8192 \$rootpath /newroot
+    mount -n -t nfs -o ro,nolock,posix,tcp,wsize=8192,rsize=8192 $rootpath /newroot
     set +x
 else
     set +x
@@ -1311,14 +1311,14 @@
 initrd_gen_procdata() {
     	[ -n "$verbose" ] && echo "Adding rootfs finding based on root= option support."
 	mkdir -p $MNTIMAGE/proc
-cat << EOF >> "$s"
+cat << 'EOF' >> "$s"
 set +x
 mount -t proc none /proc
-root="\$(busybox awk ' /root=\/dev\// { gsub(/.*root=\/dev\//,NIL,\$0); gsub(/ .*/,NIL,\$0); print \$0; } ' /proc/cmdline)"
-if [ -n "\$root" ]; then
-    rootnr="\$(busybox awk -v root="\$root" ' { if (\$4 == root) { print 256*\$1+\$2; } } ' /proc/partitions)"
-    if [ -n "\$rootnr" ]; then
-	echo "\$rootnr" > /proc/sys/kernel/real-root-dev
+root="$(busybox awk ' /root=\/dev\// { gsub(/.*root=\/dev\//,NIL,$0); gsub(/ .*/,NIL,$0); print $0; } ' /proc/cmdline)"
+if [ -n "$root" ]; then
+    rootnr="$(busybox awk -v root="$root" ' { if ($4 == root) { print 256*$1+$2; } } ' /proc/partitions)"
+    if [ -n "$rootnr" ]; then
+	echo "$rootnr" > /proc/sys/kernel/real-root-dev
     fi
 fi
 umount /proc


More information about the pld-cvs-commit mailing list