Do not use --end-date and --days together
This commit is contained in:
parent
191ba257d9
commit
abf6fb131c
10
shellpki
10
shellpki
|
@ -369,6 +369,8 @@ create() {
|
||||||
replace_existing=0
|
replace_existing=0
|
||||||
days=""
|
days=""
|
||||||
end_date=""
|
end_date=""
|
||||||
|
days_set=0
|
||||||
|
end_date_set=0
|
||||||
|
|
||||||
# Parse options
|
# Parse options
|
||||||
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
# based on https://gist.github.com/deshion/10d3cb5f88a21671e17a
|
||||||
|
@ -433,6 +435,7 @@ create() {
|
||||||
# days option, with value separated by space
|
# days option, with value separated by space
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
days=${2}
|
days=${2}
|
||||||
|
days_set=1
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
error "Argument error: \`--days' requires a value"
|
error "Argument error: \`--days' requires a value"
|
||||||
|
@ -441,6 +444,7 @@ create() {
|
||||||
--days=?*)
|
--days=?*)
|
||||||
# days option, with value separated by =
|
# days option, with value separated by =
|
||||||
days=${1#*=}
|
days=${1#*=}
|
||||||
|
days_set=1
|
||||||
;;
|
;;
|
||||||
--days=)
|
--days=)
|
||||||
# days options, without value
|
# days options, without value
|
||||||
|
@ -450,6 +454,7 @@ create() {
|
||||||
# end-date option, with value separated by space
|
# end-date option, with value separated by space
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
end_date=${2}
|
end_date=${2}
|
||||||
|
end_date_set=1
|
||||||
shift
|
shift
|
||||||
else
|
else
|
||||||
error "Argument error: \`--end-date' requires a value"
|
error "Argument error: \`--end-date' requires a value"
|
||||||
|
@ -458,6 +463,7 @@ create() {
|
||||||
--end-date=?*)
|
--end-date=?*)
|
||||||
# end-date option, with value separated by =
|
# end-date option, with value separated by =
|
||||||
end_date=${1#*=}
|
end_date=${1#*=}
|
||||||
|
end_date_set=1
|
||||||
;;
|
;;
|
||||||
--end-date=)
|
--end-date=)
|
||||||
# end-date options, without value
|
# end-date options, without value
|
||||||
|
@ -487,6 +493,10 @@ create() {
|
||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "${days_set}" -eq 1 ] && [ "${end_date_set}" -eq 1 ]; then
|
||||||
|
error "Argument error: \`--end-date' and \`--days' cannot be used together."
|
||||||
|
fi
|
||||||
|
|
||||||
# The name of the certificate
|
# The name of the certificate
|
||||||
cn="${1:-}"
|
cn="${1:-}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue