Use printf with column in the listCONF.sh script

This commit is contained in:
Orazio 2019-12-09 17:05:34 +01:00
parent 4466f1503c
commit cd1b8fbf7f
3 changed files with 10 additions and 8 deletions

View file

@ -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[@]
}

View file

@ -35,4 +35,4 @@ else
printf "\nNo Clients Connected!\n"
fi
printf "\n"
} | column -t -s $'\t'
} | column -t -s $'\t'

View file

@ -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 '&'
printf "\n"
} | column -t -s $'\t'