mirror of
https://github.com/acmesh-official/acme.sh.git
synced 2025-05-02 04:22:44 +00:00
Update edgemax.sh
fixed formatting and some added some quotation marks to make Travis Happy.
This commit is contained in:
parent
e0d630d7a9
commit
2b129b9aba
@ -14,10 +14,10 @@
|
||||
|
||||
######## Public functions #####################
|
||||
function atexit() {
|
||||
#closes CLI session
|
||||
cli-shell-api teardownSession
|
||||
_debug EXITCODE: $1
|
||||
return $1
|
||||
#closes CLI session
|
||||
cli-shell-api teardownSession
|
||||
_debug EXITCODE: "$1"
|
||||
return "$1"
|
||||
}
|
||||
|
||||
|
||||
@ -28,12 +28,11 @@ edgemax_deploy() {
|
||||
_ccert="$3"
|
||||
_cca="$4"
|
||||
_cfullchain="$5"
|
||||
|
||||
### 'lighttpd_pem' - certificate file configured for your Edgemax GUI
|
||||
|
||||
lighttpd_pem=/config/auth/le-cert.pem
|
||||
|
||||
_info "$(__green "EdgeMax Certificate Path: $lighttpd_pem")"
|
||||
_info "$(__green "EdgeMax Certificate Path: $lighttpd_pem")"
|
||||
_debug _cdomain "$_cdomain"
|
||||
_debug _ckey "$_ckey"
|
||||
_debug _ccert "$_ccert"
|
||||
@ -42,40 +41,41 @@ edgemax_deploy() {
|
||||
_info "Generating PEM file for lighttpd"
|
||||
sudo sh -c "cat ${_ccert} ${_ckey} > ${lighttpd_pem}"
|
||||
|
||||
_info "$(__green "Checking EdgeMax Config for SSL Settings: $lighttpd_pem")"
|
||||
vals=$( cli-shell-api returnEffectiveValue service gui cert-file)
|
||||
_info "$(__green "Checking EdgeMax Config for SSL Settings: $lighttpd_pem")"
|
||||
vals=$(cli-shell-api returnEffectiveValue service gui cert-file)
|
||||
certfile=$vals
|
||||
if [ "$lighttpd_pem" != "$certfile" ]; then
|
||||
_debug "Current Edgemax Certfile" "$certfile"
|
||||
_info "Certfile is not set to $lighttpd_pem"
|
||||
_debug "Current Edgemax Certfile" "$certfile"
|
||||
_info "Certfile is not set to $lighttpd_pem"
|
||||
|
||||
# Obtain session environment
|
||||
session_env=$(cli-shell-api getSessionEnv $PPID)
|
||||
eval $session_env
|
||||
|
||||
# Setup the session
|
||||
cli-shell-api setupSession
|
||||
vyatta_sbindir="/opt/vyatta/sbin" #overwritten by eval command but needed to pass github checks.
|
||||
# Obtain session environment
|
||||
session_env=$(cli-shell-api getSessionEnv $PPID)
|
||||
eval "$session_env"
|
||||
|
||||
# Verify Session Started
|
||||
cli-shell-api inSession
|
||||
if [ $? -ne 0 ]; then
|
||||
_err "Something went wrong starting CLI Session!"
|
||||
atexit 1
|
||||
fi
|
||||
SET=${vyatta_sbindir}/my_set
|
||||
COMMIT=${vyatta_sbindir}/my_commit
|
||||
SAVE=${vyatta_sbindir}/vyatta-save-config.pl
|
||||
_info "Setting Certificate parameter."
|
||||
$SET service gui cert-file /config/auth/le-cert.pem
|
||||
$COMMIT
|
||||
$SAVE
|
||||
else
|
||||
# Setup the session
|
||||
cli-shell-api setupSession
|
||||
|
||||
# Verify Session Started
|
||||
cli-shell-api inSession
|
||||
if [ $? -ne 0 ]; then
|
||||
_err "Something went wrong starting CLI Session!"
|
||||
atexit 1
|
||||
fi
|
||||
SET=${vyatta_sbindir}/my_set
|
||||
COMMIT=${vyatta_sbindir}/my_commit
|
||||
SAVE=${vyatta_sbindir}/vyatta-save-config.pl
|
||||
_info "Setting Certificate parameter."
|
||||
$SET service gui cert-file /config/auth/le-cert.pem
|
||||
$COMMIT
|
||||
$SAVE
|
||||
else
|
||||
_info "EdgeMax cert-file already set to $lighttpd_pem"
|
||||
fi
|
||||
fi
|
||||
_info Restarting lighttpd
|
||||
sudo kill -SIGTERM $(cat /var/run/lighttpd.pid)
|
||||
sudo /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
|
||||
|
||||
atexit 0
|
||||
atexit 0
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user