Update windowsInit.sh

This commit is contained in:
Molly Lau 2023-07-05 05:06:25 +09:00 committed by GitHub
parent fbdcd99e72
commit 5414bd8a89
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -69,16 +69,20 @@ mapperDevice=$(kpartx -av $loopDevice | grep "$loopDeviceNum" | head -n 1 | awk
# mount Windows dd partition to /mnt # mount Windows dd partition to /mnt
ntfs-3g /dev/mapper/$mapperDevice /mnt ntfs-3g /dev/mapper/$mapperDevice /mnt
# download initiate file
setupCompleteFile='/mnt/Users/Administrator/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/SetupComplete.bat'
wget --no-check-certificate -qO "$setupCompleteFile" ''$windowsStaticConfigCmd''
# write static config script to setup step # write static config script to setup step
[[ "$Network4Config" == "isStatic" ]] && { if [[ "$Network4Config" == "isStatic" ]]; then
setupCompleteFile='/mnt/Users/Administrator/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/SetupComplete.bat'
wget --no-check-certificate -qO "$setupCompleteFile" ''$windowsStaticConfigCmd''
sed -ri "s/IPv4/$IPv4/g" "$setupCompleteFile" sed -ri "s/IPv4/$IPv4/g" "$setupCompleteFile"
sed -ri "s/actualIp4Subnet/$actualIp4Subnet/g" "$setupCompleteFile" sed -ri "s/actualIp4Subnet/$actualIp4Subnet/g" "$setupCompleteFile"
sed -ri "s/GATE/$GATE/g" "$setupCompleteFile" sed -ri "s/GATE/$GATE/g" "$setupCompleteFile"
sed -ri "s/ipDNS1/$ipDNS1/g" "$setupCompleteFile" sed -ri "s/ipDNS1/$ipDNS1/g" "$setupCompleteFile"
sed -ri "s/ipDNS2/$ipDNS2/g" "$setupCompleteFile" sed -ri "s/ipDNS2/$ipDNS2/g" "$setupCompleteFile"
} else
sed -ri "s/setmode=on/setmode=off/g" "$setupCompleteFile"
fi
# Reboot, the system in the memory will all be written to the hard drive. # Reboot, the system in the memory will all be written to the hard drive.
# exec reboot exec reboot