[PATCH] etc/rc.d/initdiskless confusion regarding cpio archives

Rumko rumcic at gmail.com
Tue Oct 13 03:40:54 PDT 2009


"If /conf/<special_dir>/SUBDIR.cpio.gz exists, the file is cpio'd into the
specified /SUBDIR (and a memory filesystem is created for /SUBDIR if
necessary)."
. .. but to unpack the archive it uses:
"(cd / ; /usr/bin/gzip -d < $j | /usr/bin/cpio --extract -d )"

Is it just me or is there a contradiction there? English is not my native
language , so I could be misunderstanding, but my interpretation of "the file
is cpio'd into the specified /SUBDIR" would be to cd into /SUBDIR and extract
the archive there.
Also checked freebsd's head and they have the same contradiction.

Since it's more in line with other stuff in initdiskless (like SUBDIR.remove
which removes files relative to SUBDIR), I'd prefer something like the
attached patch (also gzip is skipped in the attached patch since cpio itself
seems to be able to read the gzipped archive).
-- 
Regards,
Rumko
diff --git a/etc/rc.d/initdiskless b/etc/rc.d/initdiskless
index 58e725f..ef5a329 100644
--- a/etc/rc.d/initdiskless
+++ b/etc/rc.d/initdiskless
@@ -225,7 +225,7 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
 		if [ -f $j ]; then
 			create_md $subdir
 			echo "Loading /$subdir from cpio archive $j"
-			(cd / ; /usr/bin/gzip -d < $j | /usr/bin/cpio --extract -d )
+			(cd /$subdir ; /usr/bin/cpio --extract -d -F $j )
 		fi
 	done
 	for j in /conf/$i/*.remove ; do





More information about the Submit mailing list