mirror of
https://github.com/dehydrated-io/dehydrated.git
synced 2026-07-08 14:05:25 +02:00
added version command
This commit is contained in:
@@ -46,9 +46,10 @@ Usage: ./dehydrated [-h] [command [argument]] [parameter [argument]] [parameter
|
|||||||
Default command: help
|
Default command: help
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|
--version (-v) Print version information
|
||||||
--register Register account key
|
--register Register account key
|
||||||
--account Update account contact information
|
--account Update account contact information
|
||||||
--cron (-c) Sign/renew non-existant/changed/expiring certificates.
|
--cron (-c) Sign/renew non-existent/changed/expiring certificates.
|
||||||
--signcsr (-s) path/to/csr.pem Sign a given CSR, output CRT on stdout (advanced usage)
|
--signcsr (-s) path/to/csr.pem Sign a given CSR, output CRT on stdout (advanced usage)
|
||||||
--revoke (-r) path/to/cert.pem Revoke specified certificate
|
--revoke (-r) path/to/cert.pem Revoke specified certificate
|
||||||
--cleanup (-gc) Move unused certificate files to archive directory
|
--cleanup (-gc) Move unused certificate files to archive directory
|
||||||
|
|||||||
+34
-2
@@ -11,6 +11,8 @@ set -o pipefail
|
|||||||
[[ -n "${ZSH_VERSION:-}" ]] && set -o SH_WORD_SPLIT && set +o FUNCTION_ARGZERO
|
[[ -n "${ZSH_VERSION:-}" ]] && set -o SH_WORD_SPLIT && set +o FUNCTION_ARGZERO
|
||||||
umask 077 # paranoid umask, we're creating private keys
|
umask 077 # paranoid umask, we're creating private keys
|
||||||
|
|
||||||
|
VERSION="0.4.0"
|
||||||
|
|
||||||
# Find directory in which this script is stored by traversing all symbolic links
|
# Find directory in which this script is stored by traversing all symbolic links
|
||||||
SOURCE="${0}"
|
SOURCE="${0}"
|
||||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||||
@@ -804,6 +806,31 @@ sign_domain() {
|
|||||||
echo " + Done!"
|
echo " + Done!"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Usage: --version (-v)
|
||||||
|
# Description: Print version information
|
||||||
|
command_version() {
|
||||||
|
echo "Dehydrated by Lukas Schauer"
|
||||||
|
echo "https://dehydrated.de"
|
||||||
|
echo ""
|
||||||
|
echo "Dehydrated version: ${VERSION}"
|
||||||
|
revision="$(cd "${SCRIPTDIR}"; git rev-parse HEAD 2>/dev/null || echo "unknown")"
|
||||||
|
echo "GIT-Revision: ${revision}"
|
||||||
|
echo ""
|
||||||
|
echo "OS: $(cat /etc/issue | grep -v ^$ | head -n1 | _sed 's/\\(r|n|l) .*//g')"
|
||||||
|
echo "Used software:"
|
||||||
|
[[ -n "${BASH_VERSION:-}" ]] && echo " bash: ${BASH_VERSION}"
|
||||||
|
[[ -n "${ZSH_VERSION:-}" ]] && echo " zsh: ${ZSH_VERSION}"
|
||||||
|
echo " sed: $(sed --version 2>&1 | head -n1)"
|
||||||
|
echo " openssl: $(openssl version 2>&1)"
|
||||||
|
echo " curl: $(curl --version 2>&1 | head -n1 | cut -d" " -f1-2)"
|
||||||
|
echo " awk: $(awk -W version 2>&1 | head -n1)"
|
||||||
|
echo " grep: $(grep --version 2>&1 | head -n1)"
|
||||||
|
echo " mktemp: $(mktemp --version 2>&1 | head -n1)"
|
||||||
|
echo " diff: $(diff --version 2>&1 | head -n1)"
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
}
|
||||||
|
|
||||||
# Usage: --register
|
# Usage: --register
|
||||||
# Description: Register account key
|
# Description: Register account key
|
||||||
command_register() {
|
command_register() {
|
||||||
@@ -1207,6 +1234,10 @@ main() {
|
|||||||
PARAM_REVOKECERT="${1}"
|
PARAM_REVOKECERT="${1}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--version|-v)
|
||||||
|
set_command version
|
||||||
|
;;
|
||||||
|
|
||||||
--cleanup|-gc)
|
--cleanup|-gc)
|
||||||
set_command cleanup
|
set_command cleanup
|
||||||
;;
|
;;
|
||||||
@@ -1262,9 +1293,9 @@ main() {
|
|||||||
# PARAM_Usage: --lock-suffix example.com
|
# PARAM_Usage: --lock-suffix example.com
|
||||||
# PARAM_Description: Suffix lockfile name with a string (useful for with -d)
|
# PARAM_Description: Suffix lockfile name with a string (useful for with -d)
|
||||||
--lock-suffix)
|
--lock-suffix)
|
||||||
shift 1
|
shift 1
|
||||||
check_parameters "${1:-}"
|
check_parameters "${1:-}"
|
||||||
PARAM_LOCKFILE_SUFFIX="${1}"
|
PARAM_LOCKFILE_SUFFIX="${1}"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
# PARAM_Usage: --ocsp
|
# PARAM_Usage: --ocsp
|
||||||
@@ -1340,6 +1371,7 @@ main() {
|
|||||||
sign_csr) command_sign_csr "${PARAM_CSR}";;
|
sign_csr) command_sign_csr "${PARAM_CSR}";;
|
||||||
revoke) command_revoke "${PARAM_REVOKECERT}";;
|
revoke) command_revoke "${PARAM_REVOKECERT}";;
|
||||||
cleanup) command_cleanup;;
|
cleanup) command_cleanup;;
|
||||||
|
version) command_version;;
|
||||||
*) command_help; exit 1;;
|
*) command_help; exit 1;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user