|
|
@ -4,7 +4,6 @@ |
|
|
|
|
|
|
|
|
#returns 0 means success, otherwise error. |
|
|
#returns 0 means success, otherwise error. |
|
|
|
|
|
|
|
|
#DEPLOY_LIGHTTTPD_CONF="/etc/lighttpd/lighttpd.conf" |
|
|
|
|
|
#DEPLOY_LIGHTTTPD_RELOAD="service lighttpd restart" |
|
|
#DEPLOY_LIGHTTTPD_RELOAD="service lighttpd restart" |
|
|
|
|
|
|
|
|
######## Public functions ##################### |
|
|
######## Public functions ##################### |
|
|
@ -44,59 +43,9 @@ lighttpd_deploy() { |
|
|
DEFAULT_LIGHTTTPD_RELOAD="service lighttpd restart" |
|
|
DEFAULT_LIGHTTTPD_RELOAD="service lighttpd restart" |
|
|
_reload="${DEPLOY_LIGHTTTPD_RELOAD:-$DEFAULT_LIGHTTTPD_RELOAD}" |
|
|
_reload="${DEPLOY_LIGHTTTPD_RELOAD:-$DEFAULT_LIGHTTTPD_RELOAD}" |
|
|
|
|
|
|
|
|
if [ -z "$IS_RENEW" ]; then |
|
|
|
|
|
DEFAULT_LIGHTTTPD_CONF="/etc/lighttpd/lighttpd.conf" |
|
|
|
|
|
_LIGHTTTPD_conf="${DEPLOY_LIGHTTTPD_CONF:-$DEFAULT_LIGHTTTPD_CONF}" |
|
|
|
|
|
if [ ! -f "$_LIGHTTTPD_conf" ]; then |
|
|
|
|
|
if [ -z "$DEPLOY_LIGHTTTPD_CONF" ]; then |
|
|
|
|
|
_err "lighttpd conf is not found, please define DEPLOY_LIGHTTTPD_CONF" |
|
|
|
|
|
return 1 |
|
|
|
|
|
else |
|
|
|
|
|
_err "It seems that the specified lighttpd conf is not valid, please check." |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
fi |
|
|
|
|
|
if [ ! -w "$_LIGHTTTPD_conf" ]; then |
|
|
|
|
|
_err "The file $_LIGHTTTPD_conf is not writable, please change the permission." |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
_backup_conf="$DOMAIN_BACKUP_PATH/lighttpd.conf.bak" |
|
|
|
|
|
_info "Backup $_LIGHTTTPD_conf to $_backup_conf" |
|
|
|
|
|
if ! mkdir -p "$DOMAIN_BACKUP_PATH"; then |
|
|
|
|
|
_err "Can not create folder:$DOMAIN_BACKUP_PATH" |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
if ! cat "$_LIGHTTTPD_conf" >"$_backup_conf"; then |
|
|
|
|
|
_err "Can not backup Lighttpd config to $_backup_conf" |
|
|
|
|
|
return 1 |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
# _info "Modify lighttpd conf: $_LIGHTTTPD_conf" |
|
|
|
|
|
# if _setopt "$_LIGHTTTPD_conf" "ssl.pemfile" "=" "$_real_combinedkeyandcert" \ |
|
|
|
|
|
# && _setopt "$_LIGHTTTPD_conf" "ssl.ca-file" "=" "$_real_ca" \ |
|
|
|
|
|
# && _setopt "$_LIGHTTTPD_conf" "ssl.engine" "=" "YES"; then |
|
|
|
|
|
# _info "Set config success!" |
|
|
|
|
|
# else |
|
|
|
|
|
# _err "Config lighttpd server error, please report bug to us." |
|
|
|
|
|
# _info "Restoring lighttpd conf" |
|
|
|
|
|
# if cat "$_backup_conf" >"$_LIGHTTTPD_conf"; then |
|
|
|
|
|
# _info "Restore conf success" |
|
|
|
|
|
# eval "$_reload" |
|
|
|
|
|
# else |
|
|
|
|
|
# _err "Oops, error restore lighttpd conf, please report bug to us." |
|
|
|
|
|
# fi |
|
|
|
|
|
# return 1 |
|
|
|
|
|
# fi |
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
_info "Run reload: $_reload" |
|
|
_info "Run reload: $_reload" |
|
|
if eval "$_reload"; then |
|
|
if eval "$_reload"; then |
|
|
_info "Reload success!" |
|
|
_info "Reload success!" |
|
|
if [ "$DEPLOY_LIGHTTTPD_CONF" ]; then |
|
|
|
|
|
_savedomainconf DEPLOY_LIGHTTTPD_CONF "$DEPLOY_LIGHTTTPD_CONF" |
|
|
|
|
|
else |
|
|
|
|
|
_cleardomainconf DEPLOY_LIGHTTTPD_CONF |
|
|
|
|
|
fi |
|
|
|
|
|
if [ "$DEPLOY_LIGHTTTPD_RELOAD" ]; then |
|
|
if [ "$DEPLOY_LIGHTTTPD_RELOAD" ]; then |
|
|
_savedomainconf DEPLOY_LIGHTTTPD_RELOAD "$DEPLOY_LIGHTTTPD_RELOAD" |
|
|
_savedomainconf DEPLOY_LIGHTTTPD_RELOAD "$DEPLOY_LIGHTTTPD_RELOAD" |
|
|
else |
|
|
else |
|
|
@ -104,15 +53,7 @@ lighttpd_deploy() { |
|
|
fi |
|
|
fi |
|
|
return 0 |
|
|
return 0 |
|
|
else |
|
|
else |
|
|
_err "Reload error, restoring" |
|
|
|
|
|
if cat "$_backup_conf" >"$_LIGHTTTPD_conf"; then |
|
|
|
|
|
_info "Restore conf success" |
|
|
|
|
|
eval "$_reload" |
|
|
|
|
|
else |
|
|
|
|
|
_err "Oops, error restore lighttpd conf, please report bug to us." |
|
|
|
|
|
fi |
|
|
|
|
|
return 1 |
|
|
return 1 |
|
|
fi |
|
|
fi |
|
|
return 0 |
|
|
return 0 |
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |