allow dynamic -f parameter

master
Travis Tran 3 years ago
parent 70e7048ad4
commit 577a60d075

@ -34,6 +34,12 @@ help_message(){
echo -e "\033[1m Only for the First time\033[0m" echo -e "\033[1m Only for the First time\033[0m"
echow '--install --email [EMAIL_ADDR]' echow '--install --email [EMAIL_ADDR]'
echo "${EPACE}${EPACE}Will install ACME with the Email provided" echo "${EPACE}${EPACE}Will install ACME with the Email provided"
echow '-r, --renew'
echo "${EPACE}${EPACE}Renew a specific domain with -D or --domain parameter if posibile. To force renew, use -f parameter."
echow '-R, --renew-all'
echo "${EPACE}${EPACE}Renew all domains if possible. To force renew, use -f parameter."
echow '-f, -F, --force'
echo "${EPACE}${EPACE}Force renew for a specific domain or all domains."
exit 0 exit 0
;; ;;
"3") "3")
@ -184,7 +190,6 @@ renew_acme(){
fi fi
echo '[End] Renew ACME' echo '[End] Renew ACME'
lsws_restart lsws_restart
exit 0
} }
renew_all_acme(){ renew_all_acme(){
@ -196,10 +201,17 @@ renew_all_acme(){
fi fi
echo '[End] Renew all ACME' echo '[End] Renew all ACME'
lsws_restart lsws_restart
exit 0
} }
main(){ main(){
if [ "${RENEW_ALL}" = 'true' ]; then
renew_all_acme
exit 0
elif [ "${RENEW}" = 'true' ]; then
renew_acme ${DOMAIN}
exit 0
fi
check_acme check_acme
domain_filter ${DOMAIN} domain_filter ${DOMAIN}
www_domain ${DOMAIN} www_domain ${DOMAIN}
@ -230,12 +242,10 @@ while [ ! -z "${1}" ]; do
FORCE=true FORCE=true
;; ;;
-[r] | --renew ) -[r] | --renew )
RENEW_=true RENEW=true
renew_acme ${DOMAIN}
;; ;;
-[R] | --renew-all ) -[R] | --renew-all )
RENEW_ALL=true RENEW_ALL=true
renew_all_acme
;; ;;
-[eE] | --email ) shift -[eE] | --email ) shift
check_input "${1}" check_input "${1}"

Loading…
Cancel
Save