From 5414bd8a8979d1d2c1b00309ebd7baa407de7a63 Mon Sep 17 00:00:00 2001 From: Molly Lau Date: Wed, 5 Jul 2023 05:06:25 +0900 Subject: [PATCH] Update windowsInit.sh --- Linux_reinstall/Windows/windowsInit.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Linux_reinstall/Windows/windowsInit.sh b/Linux_reinstall/Windows/windowsInit.sh index fb049aa..043d058 100644 --- a/Linux_reinstall/Windows/windowsInit.sh +++ b/Linux_reinstall/Windows/windowsInit.sh @@ -69,16 +69,20 @@ mapperDevice=$(kpartx -av $loopDevice | grep "$loopDeviceNum" | head -n 1 | awk # mount Windows dd partition to /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 -[[ "$Network4Config" == "isStatic" ]] && { - setupCompleteFile='/mnt/Users/Administrator/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup/SetupComplete.bat' - wget --no-check-certificate -qO "$setupCompleteFile" ''$windowsStaticConfigCmd'' +if [[ "$Network4Config" == "isStatic" ]]; then sed -ri "s/IPv4/$IPv4/g" "$setupCompleteFile" sed -ri "s/actualIp4Subnet/$actualIp4Subnet/g" "$setupCompleteFile" sed -ri "s/GATE/$GATE/g" "$setupCompleteFile" sed -ri "s/ipDNS1/$ipDNS1/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. -# exec reboot +exec reboot