mirror of
https://github.com/pivpn/pivpn.git
synced 2025-04-26 17:20:12 +00:00
Use printf with column in the listCONF.sh script
This commit is contained in:
parent
4466f1503c
commit
cd1b8fbf7f
3 changed files with 10 additions and 8 deletions
|
@ -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"
|
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
|
# 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
|
# 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
|
# grep and dnsutils but dnsutils is already installed, we save grep here. This way when uninstalling
|
||||||
|
@ -698,9 +698,9 @@ askWhichVPN(){
|
||||||
|
|
||||||
installOpenVPN(){
|
installOpenVPN(){
|
||||||
echo "::: Installing OpenVPN from Debian package... "
|
echo "::: Installing OpenVPN from Debian package... "
|
||||||
# grepcidr is used to redact IPs in the debug log, expect is used to feed easy-rsa
|
# grepcidr is used to redact IPs in the debug log whereas expect is used
|
||||||
# with passwords, bsdmainutils provides column to format the terminal output
|
# to feed easy-rsa with passwords
|
||||||
PIVPN_DEPS=(openvpn grepcidr expect bsdmainutils)
|
PIVPN_DEPS=(openvpn grepcidr expect)
|
||||||
installDependentPackages PIVPN_DEPS[@]
|
installDependentPackages PIVPN_DEPS[@]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,4 +35,4 @@ else
|
||||||
printf "\nNo Clients Connected!\n"
|
printf "\nNo Clients Connected!\n"
|
||||||
fi
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
} | column -t -s $'\t'
|
} | column -t -s $'\t'
|
||||||
|
|
|
@ -6,8 +6,9 @@ if [ ! -s clients.txt ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
{
|
||||||
# Present the user with a summary of the clients, fetching info from dates.
|
# 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
|
while read -r LINE; do
|
||||||
CLIENT_NAME="$(awk '{print $1}' <<< "$LINE")"
|
CLIENT_NAME="$(awk '{print $1}' <<< "$LINE")"
|
||||||
|
@ -17,7 +18,8 @@ while read -r LINE; do
|
||||||
# Dates are converted from UNIX time to human readable.
|
# Dates are converted from UNIX time to human readable.
|
||||||
CD_FORMAT="$(date -d @"$CREATION_DATE" +'%d %b %Y, %H:%M, %Z')"
|
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
|
done < clients.txt
|
||||||
|
|
||||||
echo -e "$FORMATTED" | column -t -s '&'
|
printf "\n"
|
||||||
|
} | column -t -s $'\t'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue