From 46bd2cec69ac1a43b5162bb12a10ef70c547dd87 Mon Sep 17 00:00:00 2001 From: angristan Date: Tue, 11 Feb 2020 23:46:23 +0100 Subject: [PATCH] Show client conf as QR Code after install Fix #49 --- wireguard-install.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index 7c7bcd6..bcdad72 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -86,23 +86,23 @@ if [[ "$OS" = 'ubuntu' ]]; then add-apt-repository ppa:wireguard/wireguard apt-get update apt-get install "linux-headers-$(uname -r)" - apt-get install wireguard iptables resolvconf + apt-get install wireguard iptables resolvconf qrencode elif [[ "$OS" = 'debian' ]]; then 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 apt update apt-get install "linux-headers-$(uname -r)" - apt install wireguard iptables resolvconf + apt install wireguard iptables resolvconf qrencode elif [[ "$OS" = 'fedora' ]]; then dnf copr enable jdoss/wireguard - dnf install wireguard-dkms wireguard-tools iptables + dnf install wireguard-dkms wireguard-tools iptables qrencode 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 yum install epel-release - yum install wireguard-dkms wireguard-tools iptables + yum install wireguard-dkms wireguard-tools iptables qrencode elif [[ "$OS" = 'arch' ]]; then pacman -S linux-headers - pacman -S wireguard-tools iptables wireguard-arch + pacman -S wireguard-tools iptables wireguard-arch qrencode fi # 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 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"