init tuto2: don't save the token before validating it

This commit is contained in:
nemunaire 2019-03-15 18:26:12 +01:00
parent 5ba8ccc0df
commit 58b939a61b

View File

@ -113,7 +113,6 @@ files:
echo -n "You didn't define your token to connect the network. Please copy it here now: " echo -n "You didn't define your token to connect the network. Please copy it here now: "
read WGTOKEN read WGTOKEN
} }
echo -n "${WGTOKEN}" > etc/adlin.token
/sbin/sysctl -w net.ipv6.conf.eth0.autoconf=0 /sbin/sysctl -w net.ipv6.conf.eth0.autoconf=0
/bin/ip link set up dev eth0 /bin/ip link set up dev eth0
/bin/busybox udhcpc -n -q /bin/busybox udhcpc -n -q
@ -130,6 +129,8 @@ files:
echo "Sorry, I was unable to establish a connection to adlin.nemunai.re." echo "Sorry, I was unable to establish a connection to adlin.nemunai.re."
echo "Please verify that your primary network interface can obtain an IPv4 through DHCP." echo "Please verify that your primary network interface can obtain an IPv4 through DHCP."
echo "" echo ""
echo "If curl report a 400 error, then you probably mistyped the token, you should reboot now."
echo ""
echo "Dropping to a shell, please fix your network, then press Ctrl+D or exit to retry." echo "Dropping to a shell, please fix your network, then press Ctrl+D or exit to retry."
echo "" echo ""
echo "****************************************" echo "****************************************"
@ -137,6 +138,7 @@ files:
/bin/busybox cttyhack /usr/sbin/chroot . /bin/sh /bin/busybox cttyhack /usr/sbin/chroot . /bin/sh
echo "Retrying connection..." echo "Retrying connection..."
done done
echo -n "${WGTOKEN}" > etc/adlin.token
/sbin/modprobe wireguard /sbin/modprobe wireguard
/bin/ip link add dev wg0 type wireguard /bin/ip link add dev wg0 type wireguard
/usr/bin/wg setconf wg0 etc/wireguard/adlin.conf /usr/bin/wg setconf wg0 etc/wireguard/adlin.conf