Add version output option and info
Now supports both --version and "version and outputs detailed version information. Tested on FreeBSD, macOS, and Windows 10 64-bit. Sample Output: EasyRSA Version Information Version: git-development Generated: Tue Apr 14 18:54:42 CDT 2020 SSL Lib: OpenSSL 1.1.1a-freebsd 20 Nov 2018 Git Commit: f0129cfe6222820a85db2d394ab73d3c7759c5be Source Repo: https://github.com/OpenVPN/easy-rsa This closes #372 Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
parent
f0129cfe62
commit
3e93f925d3
@ -79,7 +79,11 @@ stage_unix() {
|
||||
done
|
||||
|
||||
# FreeBSD does not accept -i without argument in a way also acceptable by GNU sed
|
||||
sed -i.tmp -e "s/~VER~/$VERSION/" "$DIST_ROOT/unix/$PV/easyrsa" || die "Cannot update easyrsa version"
|
||||
sed -i.tmp -e "s/~VER~/$VERSION/" \
|
||||
-e "s/~DATE~/$(date)/" \
|
||||
-e "s/~HOST~/$(hostname -s)/" \
|
||||
-e "s/~GITHEAD~/$(git rev-parse HEAD)/" \
|
||||
"$DIST_ROOT/unix/$PV/easyrsa" || die "Cannot update easyrsa version data"
|
||||
rm -f "$DIST_ROOT/unix/$PV/easyrsa.tmp"
|
||||
|
||||
# files not included
|
||||
@ -116,6 +120,13 @@ stage_win() {
|
||||
cp -R "$SRC_ROOT/distro/windows/$f" "$DIST_ROOT/$win/$PV/" || die "failed to copy $f"
|
||||
unix2dos "$DIST_ROOT/$win/$PV/$f" || die "unix2dos conversion failed for $f"
|
||||
done
|
||||
|
||||
sed -i.tmp -e "s/~VER~/$VERSION/" \
|
||||
-e "s/~DATE~/$(date)/" \
|
||||
-e "s/~HOST~/$(hostname -s)/" \
|
||||
-e "s/~GITHEAD~/$(git rev-parse HEAD)/" \
|
||||
"$DIST_ROOT/$win/$PV/easyrsa" || die "Cannot update easyrsa version data"
|
||||
rm -f "$DIST_ROOT/$win/$PV/easyrsa.tmp"
|
||||
|
||||
# files not included
|
||||
rm -rf "$DIST_ROOT/$win/$PV/doc/TODO" || die "failed rm TODO"
|
||||
|
||||
@ -221,6 +221,7 @@ General options:
|
||||
--passout=ARG : set -passout ARG for openssl
|
||||
--pki-dir=DIR : declares the PKI directory
|
||||
--vars=FILE : define a specific 'vars' file to use for Easy-RSA config
|
||||
--version : prints EasyRSA version and build information, then exits
|
||||
|
||||
Certificate & Request options: (these impact cert/req field values)
|
||||
|
||||
@ -2319,6 +2320,18 @@ return 0
|
||||
|
||||
} # => up23_manage_upgrade_23 ()
|
||||
|
||||
print_version()
|
||||
{
|
||||
cat <<HERE
|
||||
EasyRSA Version Information
|
||||
Version: ~VER~
|
||||
Generated: ~DATE~
|
||||
SSL Lib: $(openssl version)
|
||||
Git Commit: ~GITHEAD~
|
||||
Source Repo: https://github.com/OpenVPN/easy-rsa
|
||||
HERE
|
||||
exit 0
|
||||
} # => print_version ()
|
||||
|
||||
|
||||
########################################
|
||||
@ -2398,6 +2411,9 @@ while :; do
|
||||
export EASYRSA_EXTRA_EXTS="\
|
||||
$EASYRSA_EXTRA_EXTS
|
||||
subjectAltName = $val" ;;
|
||||
--version)
|
||||
print_version
|
||||
;;
|
||||
*)
|
||||
break ;;
|
||||
esac
|
||||
@ -2498,6 +2514,9 @@ case "$cmd" in
|
||||
cmd_help "$1"
|
||||
exit 0
|
||||
;;
|
||||
version)
|
||||
print_version
|
||||
;;
|
||||
*)
|
||||
die "Unknown command '$cmd'. Run without commands for usage help."
|
||||
;;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user