Permalink
Browse files

Add dump support to image (#644)

  • Loading branch information...
swills authored and bapt committed Oct 1, 2018
1 parent 6b07d20 commit da04bd001b6a66c2c5df7ed4e96ec9bc3f6cdf6d
Showing with 13 additions and 5 deletions.
  1. +13 −5 src/share/poudriere/image.sh
@@ -44,7 +44,7 @@ Parameters:
-t type -- Type of image can be one of (default iso+zmfs):
-- iso, iso+mfs, iso+zmfs, usb, usb+mfs, usb+zmfs,
rawdisk, zrawdisk, tar, firmware, rawfirmware,
embedded
embedded, dump
-X excludefile -- File containing the list in cpdup format
-z set -- Set
EOF
@@ -157,7 +157,7 @@ while getopts "c:f:h:j:m:n:o:p:s:t:X:z:" FLAG; do
case ${MEDIATYPE} in
iso|iso+mfs|iso+zmfs|usb|usb+mfs|usb+zmfs) ;;
rawdisk|zrawdisk|tar|firmware|rawfirmware) ;;
embedded) ;;
embedded|dump) ;;
*) err 1 "invalid mediatype: ${MEDIATYPE}"
esac
;;
@@ -214,7 +214,7 @@ jail_exists ${JAILNAME} || err 1 "The jail ${JAILNAME} does not exist"
_jget arch ${JAILNAME} arch
get_host_arch host_arch
case "${MEDIATYPE}" in
usb|*firmware|*rawdisk|embedded)
usb|*firmware|*rawdisk|embedded|dump)
[ -n "${IMAGESIZE}" ] || err 1 "Please specify the imagesize"
_jget mnt ${JAILNAME} mnt
test -f ${mnt}/boot/kernel/kernel || err 1 "The ${MEDIATYPE} media type requires a jail with a kernel"
@@ -291,7 +291,7 @@ embedded)
mkdir -p ${WRKDIR}/world/boot/msdos
mount_msdosfs /dev/${md}s1 /${WRKDIR}/world/boot/msdos
;;
rawdisk)
rawdisk|dump)
truncate -s ${IMAGESIZE} ${WRKDIR}/raw.img
md=$(/sbin/mdconfig ${WRKDIR}/raw.img)
newfs -j -L ${IMAGENAME} /dev/${md}
@@ -408,7 +408,7 @@ iso)
EOF
cpdup -i0 ${WRKDIR}/world/boot ${WRKDIR}/out/boot
;;
rawdisk)
rawdisk|dump)
cat >> ${WRKDIR}/world/etc/fstab <<-EOF
/dev/ufs/${IMAGENAME} / ufs rw 1 1
EOF
@@ -564,6 +564,14 @@ rawdisk)
md=
mv ${WRKDIR}/raw.img ${OUTPUTDIR}/${FINALIMAGE}
;;
dump)
FINALIMAGE=${IMAGENAME}.dump
umount ${WRKDIR}/world
dump -0Raf ${WRKDIR}/raw.dump /dev/${md}
/sbin/mdconfig -d -u ${md#md}
md=
mv ${WRKDIR}/raw.dump ${OUTPUTDIR}/${FINALIMAGE}
;;
embedded)
FINALIMAGE=${IMAGENAME}.img
umount ${WRKDIR}/world/boot/msdos

0 comments on commit da04bd0

Please sign in to comment.