]> wimlib.net Git - wimlib/blobdiff - programs/mkwinpeimg.in
Cleanups
[wimlib] / programs / mkwinpeimg.in
index cb997fe128f39968a46d506bf23884ffecf8b067..654249b24cf73f9c459145c87671caee9dceaff0 100755 (executable)
@@ -18,7 +18,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-script_name="$(basename $0)"
+script_name="$(basename "$0")"
 PREFIX_REG="::"
 WIMLIB_VERSION=@VERSION@
 imagex=@IMAGEX_PROGNAME@
@@ -116,7 +116,7 @@ EOF
 }
 
 version() {
-       echo "$script_name (wimlib $WIMLIB_VERSION)"
+       echo "$script_name (distributed with wimlib $WIMLIB_VERSION)"
        exit 0
 }
 
@@ -408,13 +408,13 @@ modify_boot_wim() {
 
        if [ -n "$start_script" ]; then
                stat_busy "Setting \"$start_script\" as the script to be executed when Windows PE boots"
-               cp "$start_script" "$tmp_dir/$start_script"
+               start_script_base="$(basename "$start_script")"
                cat > "$tmp_dir/__mkwinpeimg.winpeshl.ini" <<- EOF
                        [LaunchApps]
-                       %SYSTEMDRIVE%\\$start_script
+                       %SYSTEMDRIVE%\\$start_script_base
                EOF
                cat 1>&3 <<- EOF
-                       add '$tmp_dir/$start_script' '/$start_script'
+                       add '$start_script' '/$start_script_base'
                        delete --force /Windows/System32/winpeshl.ini
                        add '$tmp_dir/__mkwinpeimg.winpeshl.ini' /Windows/System32/winpeshl.ini
                EOF
@@ -473,11 +473,26 @@ make_disk_img() {
 
        export MTOOLSRC="$mtool_conf"
 
-       mformat -h 255 -s 63 -T $(( image_size / 512)) s:
-       mcopy -s "$tmp_dir"/* s:
+       mformat -h 255 -s 63 -T $(( image_size / 512)) s: || stat_fail
+       mcopy -s "$tmp_dir"/* s: || stat_fail
 
        syslinux --install "$image"
-       mcopy /usr/lib/syslinux/chain.c32 s:
+
+       syslinuxdir="/usr/lib/syslinux"
+
+       if [ -d "$syslinuxdir/bios" ]; then
+               biosdir="$syslinuxdir/bios"
+       else
+               biosdir="$syslinuxdir"
+       fi
+
+       mcopy "$biosdir/chain.c32" s: || stat_fail
+       if [ -e "$biosdir/libcom32.c32" ]; then
+               mcopy "$biosdir/libcom32.c32" s:
+       fi
+       if [ -e "$biosdir/libutil.c32" ]; then
+               mcopy "$biosdir/libutil.c32" s:
+       fi
        mcopy - 's:syslinux.cfg' <<- EOF
                DEFAULT winpe
                LABEL   winpe