Update windowsInit.sh

This commit is contained in:
Molly Lau 2023-10-13 17:10:54 +09:00 committed by GitHub
parent 924a71c0e9
commit 8e29108304
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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.