95 lines
2.3 KiB
Bash
Executable File
95 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
if [ -z "${1}" -o "${2}" ]
|
|
then
|
|
echo falsch
|
|
exit 1
|
|
fi
|
|
if [ ${1:0:4} = disk -a ${#1} -eq 5 ]
|
|
then
|
|
# echo richtig, genau ein parameter ${1:0:4} wurde übergeben!
|
|
diskdev=${1}
|
|
diskutil list external physical $diskdev | grep ${diskdev} >/dev/null 2>&1
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo no external physical device ${diskdev} found
|
|
else
|
|
echo
|
|
echo Preparing to create Windows Installation Media on:
|
|
echo
|
|
diskutil list external physical $diskdev
|
|
echo
|
|
echo "are you absolutely sure that you do not need the data on ${diskdev}"
|
|
echo "and want to proceed formatting and overwriting it? enter yes (otherwise anything else or ctrl-c)"
|
|
echo
|
|
read a
|
|
if [ "${a}" != "yes" ]
|
|
then
|
|
echo "ok, aborting ..."
|
|
exit 1
|
|
fi
|
|
fi
|
|
else
|
|
echo only one parameter allowed: disk0 to disk9
|
|
fi
|
|
type wimlib-imagex >/dev/null 2>&1
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo wimlib-imagex could not be found
|
|
echo Aborting ...
|
|
exit 1
|
|
fi
|
|
echo Formatting ...
|
|
sleep 5
|
|
diskutil eraseDisk MS-DOS WINDOWS11 MBR ${diskdev}
|
|
df -T udf | grep CCCOMA
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo "DVD/iso not mounted, want to mount ~/Downloads/Win11_23H2_English_x64v2.iso (yes/no)"
|
|
read a
|
|
if [ ${a} != "yes" ]
|
|
then
|
|
echo "ok, aborting ..."
|
|
exit 1
|
|
else
|
|
open ~/Downloads/Win11_23H2_English_x64v2.iso
|
|
sleep 5
|
|
fi
|
|
fi
|
|
df -T udf | grep CCCOMA
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo something went wrong, iso not mounted as CCCOMA
|
|
echo maybe it is unmounted but not ejected?
|
|
echo please have a look:
|
|
diskutil list virtual
|
|
echo aborting ...
|
|
exit 1
|
|
fi
|
|
df -T msdos | grep WINDOWS11
|
|
if [ $? -ne 0 ]
|
|
then
|
|
echo can not find USB drive named WINDOWS11
|
|
echo aborting...
|
|
exit 1
|
|
fi
|
|
rsync -ha --progress --exclude=sources/install.wim /Volumes/CCCOMA_X64FRE_EN-US_DV9/* /Volumes/WINDOWS11
|
|
RC=$?
|
|
if [ ${RC} -ne 0 ]
|
|
then
|
|
echo something went wrong with rsync, rc=${RC}
|
|
echo aborting...
|
|
exit 1
|
|
fi
|
|
wimlib-imagex split /Volumes/CCCOMA_X64FRE_EN-US_DV9/sources/install.wim /Volumes/WINDOWS11/sources/install.swm 3000
|
|
RC=$?
|
|
if [ ${RC} -ne 0 ]
|
|
then
|
|
echo something went wrong with wimlib-imagex, rc=${RC}
|
|
echo aborting...
|
|
exit 1
|
|
fi
|
|
df -hT udf,msdos
|
|
echo copying SWSetup to USB drive
|
|
rsync -ha --progress ~/Downloads/SWSetup /Volumes/WINDOWS11/
|
|
|