Show client conf as QR Code after install

Fix #49
This commit is contained in:
angristan 2020-02-11 23:46:23 +01:00
parent ac1fb87a4c
commit 46bd2cec69

View File

@ -86,23 +86,23 @@ if [[ "$OS" = 'ubuntu' ]]; then
add-apt-repository ppa:wireguard/wireguard add-apt-repository ppa:wireguard/wireguard
apt-get update apt-get update
apt-get install "linux-headers-$(uname -r)" apt-get install "linux-headers-$(uname -r)"
apt-get install wireguard iptables resolvconf apt-get install wireguard iptables resolvconf qrencode
elif [[ "$OS" = 'debian' ]]; then elif [[ "$OS" = 'debian' ]]; then
echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list echo "deb http://deb.debian.org/debian/ unstable main" > /etc/apt/sources.list.d/unstable.list
printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable printf 'Package: *\nPin: release a=unstable\nPin-Priority: 90\n' > /etc/apt/preferences.d/limit-unstable
apt update apt update
apt-get install "linux-headers-$(uname -r)" apt-get install "linux-headers-$(uname -r)"
apt install wireguard iptables resolvconf apt install wireguard iptables resolvconf qrencode
elif [[ "$OS" = 'fedora' ]]; then elif [[ "$OS" = 'fedora' ]]; then
dnf copr enable jdoss/wireguard dnf copr enable jdoss/wireguard
dnf install wireguard-dkms wireguard-tools iptables dnf install wireguard-dkms wireguard-tools iptables qrencode
elif [[ "$OS" = 'centos' ]]; then elif [[ "$OS" = 'centos' ]]; then
curl -Lo /etc/yum.repos.d/wireguard.repo https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo curl -Lo /etc/yum.repos.d/wireguard.repo https://copr.fedorainfracloud.org/coprs/jdoss/wireguard/repo/epel-7/jdoss-wireguard-epel-7.repo
yum install epel-release yum install epel-release
yum install wireguard-dkms wireguard-tools iptables yum install wireguard-dkms wireguard-tools iptables qrencode
elif [[ "$OS" = 'arch' ]]; then elif [[ "$OS" = 'arch' ]]; then
pacman -S linux-headers pacman -S linux-headers
pacman -S wireguard-tools iptables wireguard-arch pacman -S wireguard-tools iptables wireguard-arch qrencode
fi fi
# Make sure the directory exists (this does not seem the be the case on fedora) # Make sure the directory exists (this does not seem the be the case on fedora)
@ -160,3 +160,7 @@ sysctl --system
systemctl start "wg-quick@$SERVER_WG_NIC" systemctl start "wg-quick@$SERVER_WG_NIC"
systemctl enable "wg-quick@$SERVER_WG_NIC" systemctl enable "wg-quick@$SERVER_WG_NIC"
echo "Here is your client config file as a QR Code:"
qrencode -t ansiutf8 -l L < "$HOME/$SERVER_WG_NIC-client.conf"