]> wimlib.net Git - wimlib/commitdiff
mkwinpeimg: Support writing ISO image to stdout
authorEric Biggers <ebiggers3@gmail.com>
Tue, 29 Apr 2014 22:45:37 +0000 (17:45 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 29 Apr 2014 22:51:37 +0000 (17:51 -0500)
NEWS
doc/man1/mkwinpeimg.1.in
programs/mkwinpeimg.in

diff --git a/NEWS b/NEWS
index 727f8ab53a01788870f5daa4cc2fc07f2d1119db..e44ff0be76358683aed8d0b4647e08e78c06c85d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,9 @@ Version 1.6.3-BETA:
        Fixed reading out-of-order entries in lookup table of version 3584 WIM /
        ESD files.
 
        Fixed reading out-of-order entries in lookup table of version 3584 WIM /
        ESD files.
 
+       The 'mkwinpeimg' script now supports writing the ISO image to standard
+       output.
+
        The shared library version has been bumped up; however, there are only a
        few incompatibilities:
 
        The shared library version has been bumped up; however, there are only a
        few incompatibilities:
 
index befa28044405755b8b015537931ba225d09b3398..b0a5e96ac603071221cc24d3b4b55698f0494415 100644 (file)
@@ -24,7 +24,8 @@ required so that the FAT filesystem can be created without root privileges.
 .PP
 The other type of bootable image that \fBmkwinpeimg\fR can make is a bootable
 ISO image.  To make this type of image, give the \fB--iso\fR option.
 .PP
 The other type of bootable image that \fBmkwinpeimg\fR can make is a bootable
 ISO image.  To make this type of image, give the \fB--iso\fR option.
-\fBmkisofs\fR(1) is required to make this type of image.
+\fBmkisofs\fR(1) is required to make this type of image.  In \fB--iso\fR mode,
+you can specify \fIIMAGE\fR as "-" to write the ISO image to standard output.
 .PP
 If you make a disk image, you could put it on a USB drive, and if you make an
 ISO image, you could put it on a CD.  In addition, both types of images can be
 .PP
 If you make a disk image, you could put it on a USB drive, and if you make an
 ISO image, you could put it on a CD.  In addition, both types of images can be
index 654249b24cf73f9c459145c87671caee9dceaff0..48ffebb3442dbf2346ada080ce44bdf482fc84ab 100755 (executable)
@@ -256,7 +256,7 @@ EOF
 
 check_needed_programs() {
        if [ -z "$waik_dir" -o -n "$modify_wim" ]; then
 
 check_needed_programs() {
        if [ -z "$waik_dir" -o -n "$modify_wim" ]; then
-               if ! type -P @IMAGEX_PROGNAME@ &> /dev/null ; then
+               if ! type -P "$imagex" &> /dev/null ; then
                        cat << EOF
 ERROR: To make a customized image of Windows PE, we need the "$imagex" program
 from "wimlib" so that we can modify the boot.wim file.  However, "$imagex"
                        cat << EOF
 ERROR: To make a customized image of Windows PE, we need the "$imagex" program
 from "wimlib" so that we can modify the boot.wim file.  However, "$imagex"
@@ -446,7 +446,7 @@ make_iso_img() {
 
        mkisofs -sysid ""  -A ""  -V "Microsoft Windows PE ($arch)"  -d -N \
                -b etfsboot.com  -no-emul-boot   -c boot.cat  -hide etfsboot.com  \
 
        mkisofs -sysid ""  -A ""  -V "Microsoft Windows PE ($arch)"  -d -N \
                -b etfsboot.com  -no-emul-boot   -c boot.cat  -hide etfsboot.com  \
-               -hide boot.cat -quiet -o "$image" "$tmp_dir" || stat_fail
+               -hide boot.cat -quiet -o "$image" "$tmp_dir" 1>&4 || stat_fail
 
        stat_done
 }
 
        stat_done
 }
@@ -506,6 +506,22 @@ make_disk_img() {
 calc_columns
 tmp_dir="$(mktemp -d)"
 process_command_line "$@"
 calc_columns
 tmp_dir="$(mktemp -d)"
 process_command_line "$@"
+
+if [ "$image" = "-" ] ; then
+       # Writing image to standard output
+       if [ "$make" != iso ]; then
+               echo "ERROR: Writing image to standard output is only supported in --iso mode!"
+               exit 1
+       fi
+       # We can't print anything to standard output except the ISO image
+       # itself.  Play with the file descriptors.
+
+       exec 4>&1  # 4 is now the original standard output.
+       exec 1>&2  # Anything that goes to standard output now, by default,
+                  # actually goes to standard error.
+else
+       exec 4>&1  # 4 is now a copy of standard output
+fi
 if [ -z "$waik_dir" ]; then
        find_windows_dir
 fi
 if [ -z "$waik_dir" ]; then
        find_windows_dir
 fi
@@ -538,4 +554,6 @@ elif [ $make = disk ]; then
        make_disk_img "$image"
 fi
 
        make_disk_img "$image"
 fi
 
-echo "The image ($image) is $(stat -c %s "$image") bytes."
+if [ "$image" != "-" ]; then
+       echo "The image ($image) is $(stat -c %s "$image") bytes."
+fi