Last active
May 8, 2023 21:57
-
-
Save pecord/24a9a3f2f26ac237ab9380934d0471fc to your computer and use it in GitHub Desktop.
Asked GPT to make a wireguard install script for a non-interactive install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eou pipefail | |
echo "Set the environment variable to non-interactive" | |
DEBIAN_FRONTEND=noninteractive | |
USER="$(whoami)" | |
echo "Update the system" | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
echo "Make directory for pivpn" | |
sudo mkdir -p /usr/local/src/pivpn | |
sudo chown -R $USER:$USER /usr/local/src/pivpn | |
echo "Download the PiVPN non-interactive installation script" | |
curl -L https://install.pivpn.io -o install_pivpn.sh | |
chmod +x install_pivpn.sh | |
echo "Download the specified WireGuard configuration" | |
curl -L https://raw.githubusercontent.com/pivpn/pivpn/master/examples/unattended_wireguard_example.conf -o unattended_wireguard_example.conf | |
echo "Run the PiVPN installation script with the specified configuration" | |
sudo ./install_pivpn.sh --unattended unattended_wireguard_example.conf | |
echo "Generate WireGuard clients and output their profiles" | |
num_clients=3 | |
for i in $(seq 1 $num_clients); do | |
sudo pivpn -a -n "client$i" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment