mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-19 19:30:16 +00:00
Apply suggestions from code review
Format Changes Reviewed. Co-Authored-By: Orazio <orazioedoardo@users.noreply.github.com>
This commit is contained in:
parent
289e85e306
commit
ec6880eb99
1 changed files with 9 additions and 7 deletions
|
@ -3,7 +3,6 @@
|
|||
# Updated Script to include Expiration Dates and Clean up Escape Seq -- psgoundar
|
||||
|
||||
INDEX="/etc/openvpn/easy-rsa/pki/index.txt"
|
||||
printf "\\n"
|
||||
if [ ! -f "${INDEX}" ]; then
|
||||
echo "The file: $INDEX was not found!"
|
||||
exit 1
|
||||
|
@ -12,7 +11,8 @@ fi
|
|||
printf ": NOTE : The first entry should always be your valid server!\n"
|
||||
printf "\\n"
|
||||
printf "\\e[1m::: Certificate Status List :::\\e[0m\\n"
|
||||
printf "\\e[4mStatus\\e[0m :: \\e[4mName\\e[0m\\e[0m :: \\e[4mExpiration \\e[0m\\n"
|
||||
{
|
||||
printf "\\e[4mStatus\\e[0m \t \\e[4mName\\e[0m\\e[0m \t \\e[4mExpiration\\e[0m\\n"
|
||||
|
||||
while read -r line || [ -n "$line" ]; do
|
||||
STATUS=$(echo "$line" | awk '{print $1}')
|
||||
|
@ -20,12 +20,14 @@ while read -r line || [ -n "$line" ]; do
|
|||
EXPD=$(echo "$line" | awk '{if (length($2) == 15) print $2; else print "20"$2}' | cut -b 1-8 | date +"%b %d %Y" -f -)
|
||||
|
||||
if [ "${STATUS}" == "V" ]; then
|
||||
printf " Valid :: %s :: %s\\n" "$NAME" "$EXPD"
|
||||
printf "Valid \t %s \t %s\\n" "$NAME" "$EXPD"
|
||||
elif [ "${STATUS}" == "R" ]; then
|
||||
printf " Revoked :: %s :: %s\\n" "$NAME" "$EXPD"
|
||||
printf " Revoked \t %s \t %s\\n" "$NAME" "$EXPD"
|
||||
else
|
||||
printf " Unknown :: %s :: %s\\n" "$NAME" "$EXPD"
|
||||
printf "Unknown \t %s \t %s\\n" "$NAME" "$EXPD"
|
||||
fi
|
||||
|
||||
done <${INDEX} | column -t
|
||||
printf "\\n"
|
||||
done <${INDEX}
|
||||
printf "\\n"
|
||||
} | column -t -s $'\t'
|
||||
printf "\\n"
|
||||
|
|
Loading…
Reference in a new issue