From cd1b8fbf7faf657aaca58f4cbf8f31f175f5c962 Mon Sep 17 00:00:00 2001 From: Orazio Date: Mon, 9 Dec 2019 17:05:34 +0100 Subject: [PATCH] Use printf with column in the listCONF.sh script --- auto_install/install.sh | 8 ++++---- scripts/openvpn/clientStat.sh | 2 +- scripts/wireguard/listCONF.sh | 8 +++++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/auto_install/install.sh b/auto_install/install.sh index 2305458..2239ebc 100755 --- a/auto_install/install.sh +++ b/auto_install/install.sh @@ -22,7 +22,7 @@ PKG_INSTALL="${PKG_MANAGER} --yes --no-install-recommends install" PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true" # Dependencies that are required by the script, regardless of the VPN protocol chosen -BASE_DEPS=(git tar wget grep iptables-persistent dnsutils whiptail net-tools) +BASE_DEPS=(git tar wget grep iptables-persistent dnsutils whiptail net-tools bsdmainutils) # Dependencies that where actually installed by the script. For example if the script requires # grep and dnsutils but dnsutils is already installed, we save grep here. This way when uninstalling @@ -698,9 +698,9 @@ askWhichVPN(){ installOpenVPN(){ echo "::: Installing OpenVPN from Debian package... " - # grepcidr is used to redact IPs in the debug log, expect is used to feed easy-rsa - # with passwords, bsdmainutils provides column to format the terminal output - PIVPN_DEPS=(openvpn grepcidr expect bsdmainutils) + # grepcidr is used to redact IPs in the debug log whereas expect is used + # to feed easy-rsa with passwords + PIVPN_DEPS=(openvpn grepcidr expect) installDependentPackages PIVPN_DEPS[@] } diff --git a/scripts/openvpn/clientStat.sh b/scripts/openvpn/clientStat.sh index ef04114..bf2c208 100755 --- a/scripts/openvpn/clientStat.sh +++ b/scripts/openvpn/clientStat.sh @@ -35,4 +35,4 @@ else printf "\nNo Clients Connected!\n" fi printf "\n" -} | column -t -s $'\t' \ No newline at end of file +} | column -t -s $'\t' diff --git a/scripts/wireguard/listCONF.sh b/scripts/wireguard/listCONF.sh index 02e5224..fd808fe 100755 --- a/scripts/wireguard/listCONF.sh +++ b/scripts/wireguard/listCONF.sh @@ -6,8 +6,9 @@ if [ ! -s clients.txt ]; then exit 1 fi +{ # Present the user with a summary of the clients, fetching info from dates. -FORMATTED+=": \e[4mClient\e[0m&\e[4mCreation date\e[0m :\n" +printf ": \e[4mClient\e[0m \t \e[4mCreation date\e[0m :\n" while read -r LINE; do CLIENT_NAME="$(awk '{print $1}' <<< "$LINE")" @@ -17,7 +18,8 @@ while read -r LINE; do # Dates are converted from UNIX time to human readable. CD_FORMAT="$(date -d @"$CREATION_DATE" +'%d %b %Y, %H:%M, %Z')" - FORMATTED+="• $CLIENT_NAME&$CD_FORMAT\n" + printf "• $CLIENT_NAME \t $CD_FORMAT\n" done < clients.txt -echo -e "$FORMATTED" | column -t -s '&' \ No newline at end of file +printf "\n" +} | column -t -s $'\t'