fix formatting

This commit is contained in:
Alfonso Gamboa 2022-05-31 00:35:49 -07:00
parent b20d1b8539
commit 1b85860e56
2 changed files with 20 additions and 15 deletions

View File

@ -299,23 +299,28 @@ if [[ "$ENABLE_WIREGUARD" == "true" ]]; then
insmod $KMOD_PATH/kernel/net/ipv4/ip_tunnel.ko
insmod $KMOD_PATH/kernel/net/wireguard/wireguard.ko
if [[ "$WIREGUARD_IPV4" != "" ]]; then
mkdir -p /opt/wz_mini/etc/wireguard
if [[ "$WIREGUARD_IPV4" != "" ]]; then
if [ ! -f /opt/wz_mini/etc/wireguard/privatekey ]; then
(umask 277 && /media/mmc/wz_mini/bin/wg genkey | /media/mmc/wz_mini/bin/busybox tee /opt/wz_mini/etc/wireguard/privatekey | /media/mmc/wz_mini/bin/wg pubkey > /opt/wz_mini/etc/wireguard/publickey)
fi
if [ -d /opt/wz_mini/etc/wireguard ]; then
echo "wireguard dir exists"
else
mkdir -p /opt/wz_mini/etc/wireguard
fi
/media/mmc/wz_mini/bin/busybox ip link add dev wg0 type wireguard
/media/mmc/wz_mini/bin/busybox ip address add dev wg0 $WIREGUARD_IPV4
/media/mmc/wz_mini/bin/wg set wg0 private-key /opt/wz_mini/etc/wireguard/privatekey
/media/mmc/wz_mini/bin/busybox ip link set wg0 up
fi
if [ ! -f /opt/wz_mini/etc/wireguard/privatekey ]; then
(umask 277 && /media/mmc/wz_mini/bin/wg genkey | /media/mmc/wz_mini/bin/busybox tee /opt/wz_mini/etc/wireguard/privatekey | /media/mmc/wz_mini/bin/wg pubkey > /opt/wz_mini/etc/wireguard/publickey)
fi
if [[ "$WIREGUARD_PEER_PUBLIC_KEY" != "" ]] && [[ "$WIREGUARD_PEER_ALLOWED_IPS" != "" ]] && [[ "$WIREGUARD_PEER_ENDPOINT" != "" ]] && [[ "$WIREGUARD_PEER_KEEP_ALIVE" != "" ]]; then
/media/mmc/wz_mini/bin/wg set wg0 peer $WIREGUARD_PEER_PUBLIC_KEY allowed-ips $WIREGUARD_PEER_ALLOWED_IPS endpoint $WIREGUARD_PEER_ENDPOINT persistent-keepalive $WIREGUARD_PEER_KEEP_ALIVE
/media/mmc/wz_mini/bin/busybox ip route add $WIREGUARD_PEER_ALLOWED_IPS dev wg0
fi
/media/mmc/wz_mini/bin/busybox ip link add dev wg0 type wireguard
/media/mmc/wz_mini/bin/busybox ip address add dev wg0 $WIREGUARD_IPV4
/media/mmc/wz_mini/bin/wg set wg0 private-key /opt/wz_mini/etc/wireguard/privatekey
/media/mmc/wz_mini/bin/busybox ip link set wg0 up
fi
if [[ "$WIREGUARD_PEER_PUBLIC_KEY" != "" ]] && [[ "$WIREGUARD_PEER_ALLOWED_IPS" != "" ]] && [[ "$WIREGUARD_PEER_ENDPOINT" != "" ]] && [[ "$WIREGUARD_PEER_KEEP_ALIVE" != "" ]]; then
/media/mmc/wz_mini/bin/wg set wg0 peer $WIREGUARD_PEER_PUBLIC_KEY allowed-ips $WIREGUARD_PEER_ALLOWED_IPS endpoint $WIREGUARD_PEER_ENDPOINT persistent-keepalive $WIREGUARD_PEER_KEEP_ALIVE
/media/mmc/wz_mini/bin/busybox ip route add $WIREGUARD_PEER_ALLOWED_IPS dev wg0
fi
else
echo "wireguard disabled"
fi

View File

@ -3,7 +3,7 @@ d41d8cd98f00b204e9800998ecf8427e SD_ROOT/wz_mini/mnt/.gitignore
34c6a4c3a941ff2becd9f487826d7692 SD_ROOT/wz_mini/etc/uvc.config
b4e404d9205a8e139571d4e5d2b55e92 SD_ROOT/wz_mini/etc/init.d/wz_cam.sh
8e813f033982c39f4e54b9cdb8d4b531 SD_ROOT/wz_mini/etc/init.d/v3_init.sh
6f8cc21a4323156d13d559c29dbf0b38 SD_ROOT/wz_mini/etc/init.d/wz_user.sh
a665ee24702edd7570ba57bedafb919f SD_ROOT/wz_mini/etc/init.d/wz_user.sh
86082f8c1b7de18463731372bac630d1 SD_ROOT/wz_mini/etc/init.d/wz_post.sh
e3034eac02d8eda9902ca9cf89f0a586 SD_ROOT/wz_mini/etc/inittab
8b5e58acfcbb20034dc4873a08b45fd9 SD_ROOT/wz_mini/etc/profile