2021-09-25 22:27:21 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2021-10-04 05:39:20 +00:00
|
|
|
printf '%b\n' "\n\033[1m"WINDOWS_INIT:"\033[0m"" Executing extract_iso.sh"
|
2021-09-28 17:38:12 +00:00
|
|
|
src/extract_iso.sh
|
2021-10-03 21:01:26 +00:00
|
|
|
EXTRACT="win/"
|
|
|
|
|
2021-10-07 22:47:00 +00:00
|
|
|
#printf '%b\n' "\n\033[1m"WINDOWS_INIT:"\033[0m"" Executing bootsect.sh"
|
|
|
|
#./src/bootsect.sh
|
|
|
|
#BOOT="bootsect.bin"
|
2021-09-25 22:27:21 +00:00
|
|
|
|
2021-09-28 17:38:12 +00:00
|
|
|
# add answerfile
|
2021-10-03 21:01:26 +00:00
|
|
|
cp data/autounattend.xml ${EXTRACT}
|
2021-10-07 22:47:00 +00:00
|
|
|
|
|
|
|
# data for mkisofs
|
|
|
|
BOOT="boot/etfsboot.com"
|
|
|
|
EFI="efi/boot/bootx64.efi"
|
|
|
|
LOAD_SEG="$(dumpet -i Win*.iso \
|
|
|
|
| grep "Media load segment: " \
|
|
|
|
| cut -d ':' -f2 \
|
|
|
|
| cut -d ' ' -f2)"
|
|
|
|
LOAD_SIZE="$(dumpet -i Win*.iso \
|
|
|
|
| grep "Load Sectors: " \
|
|
|
|
| grep -o "[^:]*$" \
|
|
|
|
| cut -d ' ' -f2 \
|
|
|
|
| head -1)"
|
2021-10-08 05:05:37 +00:00
|
|
|
LBA="$(dumpet -i Win*.iso \
|
|
|
|
| grep "LBA" \
|
2021-10-07 22:47:00 +00:00
|
|
|
| tail -n 1 \
|
|
|
|
| awk '{printf $3}')"
|
|
|
|
CDROM_SECTOR_SIZE=2048
|
|
|
|
FLOPPY_SECTOR_SIZE=512
|
|
|
|
|
2021-10-08 05:12:10 +00:00
|
|
|
dd \
|
|
|
|
if=`printf Win*.iso` \
|
|
|
|
bs=${CDROM_SECTOR_SIZE} \
|
|
|
|
skip=${LBA} \
|
|
|
|
count=1 \
|
|
|
|
> win.dmp
|
2021-10-07 22:47:00 +00:00
|
|
|
FLOPPY_SECTORS="$(file win.dmp \
|
|
|
|
| sed -e "s/.*sectors\ //" \
|
|
|
|
| awk '{printf $1}')"
|
|
|
|
|
|
|
|
CDROM_SECTORS=`expr $FLOPPY_SECTOR_SIZE \
|
|
|
|
\* $FLOPPY_SECTORS \
|
|
|
|
/ $CDROM_SECTOR_SIZE`
|
2021-10-07 22:56:57 +00:00
|
|
|
|
|
|
|
dd \
|
2021-10-08 05:12:10 +00:00
|
|
|
if=`printf Win*.iso` \
|
2021-10-07 22:56:57 +00:00
|
|
|
bs=${CDROM_SECTOR_SIZE} \
|
2021-10-08 05:05:37 +00:00
|
|
|
skip=${LBA} \
|
2021-10-07 22:56:57 +00:00
|
|
|
count=${CDROM_SECTORS} \
|
|
|
|
of=win_efi_boot.img
|
2021-09-25 22:27:21 +00:00
|
|
|
|
2021-09-28 17:38:12 +00:00
|
|
|
# install mkisofs
|
|
|
|
# recreate iso
|
2021-10-05 02:33:57 +00:00
|
|
|
cd ${EXTRACT}
|
2021-10-03 21:01:26 +00:00
|
|
|
mkisofs \
|
|
|
|
-allow-limited-size \
|
|
|
|
-no-emul-boot \
|
2021-10-07 22:47:00 +00:00
|
|
|
-b ${BOOT} \
|
|
|
|
-boot-load-seg ${LOAD_SEG} \
|
|
|
|
-boot-load-size ${LOAD_SIZE} \
|
|
|
|
-eltorito-alt-boot \
|
|
|
|
-b ${EFI} \
|
|
|
|
-eltorito-platform efi \
|
2021-10-03 21:01:26 +00:00
|
|
|
-iso-level 2 \
|
2021-10-07 22:58:39 +00:00
|
|
|
-boot-info-table \
|
|
|
|
-udf \
|
2021-10-07 22:47:00 +00:00
|
|
|
-J -l -joliet-long \
|
|
|
|
-D \
|
|
|
|
-N \
|
|
|
|
-relaxed-filenames \
|
2021-10-03 21:01:26 +00:00
|
|
|
-V "WINSP" \
|
|
|
|
-o winsp.iso \
|
2021-10-05 02:33:57 +00:00
|
|
|
.
|
2021-09-28 17:38:12 +00:00
|
|
|
|
2021-10-07 22:56:57 +00:00
|
|
|
mv winsp.iso ..
|
2021-10-04 04:52:36 +00:00
|
|
|
|
2021-10-05 02:33:57 +00:00
|
|
|
# clean up bootsect and iso extract
|
|
|
|
cd ..
|
2021-10-07 22:56:57 +00:00
|
|
|
rm win.dmp
|
|
|
|
#rm -rf bootsect/
|
2021-10-03 21:01:26 +00:00
|
|
|
sudo rm -rf ${EXTRACT}
|