From 8e291083048362b85c0ddac46b479acece443af3 Mon Sep 17 00:00:00 2001 From: Molly Lau Date: Fri, 13 Oct 2023 17:10:54 +0900 Subject: [PATCH] Update windowsInit.sh --- Linux_reinstall/Windows/windowsInit.sh | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/Linux_reinstall/Windows/windowsInit.sh b/Linux_reinstall/Windows/windowsInit.sh index bb03e21..b9918aa 100644 --- a/Linux_reinstall/Windows/windowsInit.sh +++ b/Linux_reinstall/Windows/windowsInit.sh @@ -34,6 +34,7 @@ ip6DNS2=$(grep "ip6DNS2" $confFile | awk '{print $2}') DDURL=$(grep "DDURL" $confFile | awk '{print $2}') windowsStaticConfigCmd=$(grep "windowsStaticConfigCmd" $confFile | awk '{print $2}') Network4Config=$(grep "Network4Config" $confFile | awk '{print $2}') +Network6Config=$(grep "Network6Config" $confFile | awk '{print $2}') DEC_CMD=$(grep "DEC_CMD" $confFile | awk '{print $2}') # Reset configurations of repositories. @@ -73,15 +74,26 @@ ntfs-3g /dev/mapper/$mapperDevice /mnt 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. -if [[ "$Network4Config" == "isStatic" ]]; then +# Write IPv4 static config script to setup step. +if [[ "$Network4Config" == "isStatic" && -n "$IPv4" && -n "$actualIp4Subnet" && -n "$GATE" ]]; 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" + sed -ri "s/setipv4mode=on/setipv4mode=off/g" "$setupCompleteFile" +fi + +# Write IPv6 static config script to setup step. +if [[ "$Network6Config" == "isStatic" && -n "$ip6Addr" && -n "$actualIp6Prefix" && -n "$ip6Gate" ]]; then + sed -ri "s/ip6Addr/$ip6Addr/g" "$setupCompleteFile" + sed -ri "s/actualIp6Prefix/$actualIp6Prefix/g" "$setupCompleteFile" + sed -ri "s/ip6Gate/$ip6Gate/g" "$setupCompleteFile" + sed -ri "s/ip6DNS1/$ip6DNS1/g" "$setupCompleteFile" + sed -ri "s/ip6DNS2/$ip6DNS2/g" "$setupCompleteFile" +else + sed -ri "s/setipv6mode=on/setipv6mode=off/g" "$setupCompleteFile" fi # Umount mounted directory and loop device.