summaryrefslogtreecommitdiff
path: root/sysutils
diff options
context:
space:
mode:
authorgson <gson@pkgsrc.org>2011-10-13 16:01:06 +0000
committergson <gson@pkgsrc.org>2011-10-13 16:01:06 +0000
commit1d2b582c91840c8c9503f73001c73f6ee712a248 (patch)
tree95f522f6deec4c0155efde9835f1502ae8227d61 /sysutils
parentf9259c1d1f19ceb5b32b52c3a4a6ac363d3cb003 (diff)
downloadpkgsrc-1d2b582c91840c8c9503f73001c73f6ee712a248.tar.gz
Preserve file permissions when copying files from the ISO to the
memory stick image, because otherwise recent NetBSD versions that use root on cd9660 instead of a ramdisk won't boot. This is currently implemented by using a vnd mount instead of isoinfo -x to extract the ISO contents. This solution is less than ideal since it requires root permissions and will fail if vnd0 is already in use. Still, it's better than not working at all. OK'd by agc.
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/mkmemstick/DESCR4
-rw-r--r--sysutils/mkmemstick/Makefile6
-rw-r--r--sysutils/mkmemstick/PLIST4
-rw-r--r--sysutils/mkmemstick/files/mkmemstick.sh20
4 files changed, 16 insertions, 18 deletions
diff --git a/sysutils/mkmemstick/DESCR b/sysutils/mkmemstick/DESCR
index 128806aeedb..e611779c089 100644
--- a/sysutils/mkmemstick/DESCR
+++ b/sysutils/mkmemstick/DESCR
@@ -7,11 +7,11 @@ convert it to an image that can be written to a USB memory stick.
To use the script, simply feed it an ISO and tell it where to write
the resulting image:
-$ sh mkmemstick.sh i386cd-5.0.1.iso i386memstick-5.0.1.img
+# sh mkmemstick.sh i386cd-5.0.1.iso i386memstick-5.0.1.img
The resulting image can be written to a memory stick using dd(1):
-$ dd if=i386memstick-5.0.1.img of=/dev/sd0d
+# dd if=i386memstick-5.0.1.img of=/dev/sd0d
Please note that this script depends on the sysutils/cdrtools package
for extracting the contents of the release ISO.
diff --git a/sysutils/mkmemstick/Makefile b/sysutils/mkmemstick/Makefile
index aa88cca9117..bed836fb1f6 100644
--- a/sysutils/mkmemstick/Makefile
+++ b/sysutils/mkmemstick/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.1.1.1 2011/05/05 06:53:27 agc Exp $
+# $NetBSD: Makefile,v 1.2 2011/10/13 16:01:06 gson Exp $
#
-DISTNAME= mkmemstick-20090801
+DISTNAME= mkmemstick-20111013
CATEGORIES= sysutils
MASTER_SITES= # none
DISTFILES= # none
@@ -25,7 +25,7 @@ do-configure:
do-build:
do-install:
- ${INSTALL_SCRIPT} ${WRKSRC}/mkmemstick ${DESTDIR}${PREFIX}/bin/mkmemstick
+ ${INSTALL_SCRIPT} ${WRKSRC}/mkmemstick ${DESTDIR}${PREFIX}/sbin/mkmemstick
.include "../../mk/bsd.pkg.mk"
diff --git a/sysutils/mkmemstick/PLIST b/sysutils/mkmemstick/PLIST
index 6409a566242..6849dabeddf 100644
--- a/sysutils/mkmemstick/PLIST
+++ b/sysutils/mkmemstick/PLIST
@@ -1,2 +1,2 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2011/05/05 06:53:27 agc Exp $
-bin/mkmemstick
+@comment $NetBSD: PLIST,v 1.2 2011/10/13 16:01:06 gson Exp $
+sbin/mkmemstick
diff --git a/sysutils/mkmemstick/files/mkmemstick.sh b/sysutils/mkmemstick/files/mkmemstick.sh
index 10ffc32aae9..b1960db5b4e 100644
--- a/sysutils/mkmemstick/files/mkmemstick.sh
+++ b/sysutils/mkmemstick/files/mkmemstick.sh
@@ -32,6 +32,8 @@ drivedata: 0
a: @SECTORS@ 0 4.2BSD 1024 8192 0
d: @SECTORS@ 0 unused 0 0
"
+vnddev="vnd0"
+vndmnt="${dstbase}/mnt"
die() {
echo "fatal: $0"
@@ -59,17 +61,11 @@ fi
mkdir -p "$dst" || die "couldn't create directory $dst"
-printf " => extracting iso image"
-isoinfo -R -f -i "$src" | while read x; do
- dstdir="$dst/$(dirname $x)"
- dstfile="$(basename $x)"
- if [ -f "$dstdir" ]; then
- rm "$dstdir"
- fi
- mkdir -p "$dstdir"
- printf .
- isoinfo -R -x "$x" -i "$src" > "${dstdir}/${dstfile}"
-done
+printf " => extracting iso image..."
+vnconfig "$vnddev" "$src"
+mkdir "$vndmnt"
+mount -r -t cd9660 "/dev/${vnddev}a" "$vndmnt"
+(cd "$vndmnt" && tar cf - .) | (cd "$dst" && tar xf -)
printf " done.\n"
if [ -f "${dst}/boot.cfg" ]; then
@@ -95,6 +91,8 @@ echo "$disklabel" | \
disklabel -R -F "${img}" "${dstbase}/disklabel" || die "couldn't write disklabel"
echo " => cleaning up"
+umount "${vndmnt}"
+vnconfig -u "${vnddev}"
rm -rf "${dstbase}"
echo " => done!"