include $(TOPDIR)/rules.mk
PKG_NAME:=acme
-PKG_VERSION:=2.8.7
-PKG_RELEASE:=6
+PKG_VERSION:=2.9.0
+PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/acmesh-official/acme.sh/tar.gz/$(PKG_VERSION)?
-PKG_HASH:=774010429730882f6bbfcd3756ff0fa755846106664841092af828a814159861
+PKG_HASH:=bb8cfb8333bc9e986bb8b7644d518bc238b353c871c343b7edf8cda7b7dd903c
PKG_BUILD_DIR:=$(BUILD_DIR)/acme.sh-$(PKG_VERSION)
PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
. /lib/functions.sh
-check_cron()
-{
+check_cron() {
[ -f "/etc/crontabs/root" ] && grep -q '/etc/init.d/acme' /etc/crontabs/root && return
echo "0 0 * * * /etc/init.d/acme start" >> /etc/crontabs/root
/etc/init.d/cron start
}
-log()
-{
+log() {
logger -t acme -s -p daemon.info -- "$@"
}
-err()
-{
+err() {
logger -t acme -s -p daemon.err -- "$@"
}
-debug()
-{
+debug() {
[ "$DEBUG" -eq "1" ] && logger -t acme -s -p daemon.debug -- "$@"
}
get_listeners() {
local proto rq sq listen remote state program
- netstat -nptl 2>/dev/null | while read proto rq sq listen remote state program; do
+ netstat -nptl 2> /dev/null | while read proto rq sq listen remote state program; do
case "$proto#$listen#$program" in
tcp#*:80#[0-9]*/*) echo -n "${program%% *} " ;;
esac
done
}
-run_acme()
-{
+run_acme() {
debug "Running acme.sh as '$ACME $@'"
$ACME "$@"
}
-pre_checks()
-{
+pre_checks() {
main_domain="$1"
log "Running pre checks for $main_domain."
uci set uhttpd.main.listen_http=''
uci commit uhttpd || return 1
- if ! /etc/init.d/uhttpd reload ; then
+ if ! /etc/init.d/uhttpd reload; then
uci set uhttpd.main.listen_http="$UHTTPD_LISTEN_HTTP"
uci commit uhttpd
return 1
return 0
}
-post_checks()
-{
+post_checks() {
log "Running post checks (cleanup)."
# The comment ensures we only touch our own rules. If no rules exist, that
# is fine, so hide any errors
- iptables -D input_rule -p tcp --dport 80 -j ACCEPT -m comment --comment "ACME" 2>/dev/null
- ip6tables -D input_rule -p tcp --dport 80 -j ACCEPT -m comment --comment "ACME" 2>/dev/null
+ iptables -D input_rule -p tcp --dport 80 -j ACCEPT -m comment --comment "ACME" 2> /dev/null
+ ip6tables -D input_rule -p tcp --dport 80 -j ACCEPT -m comment --comment "ACME" 2> /dev/null
- if [ -e /etc/init.d/uhttpd ] && ( [ -n "$UHTTPD_LISTEN_HTTP" ] || [ "$UPDATE_UHTTPD" -eq 1 ] ); then
+ if [ -e /etc/init.d/uhttpd ] && ([ -n "$UHTTPD_LISTEN_HTTP" ] || [ "$UPDATE_UHTTPD" -eq 1 ]); then
if [ -n "$UHTTPD_LISTEN_HTTP" ]; then
uci set uhttpd.main.listen_http="$UHTTPD_LISTEN_HTTP"
UHTTPD_LISTEN_HTTP=
/etc/init.d/uhttpd reload
fi
- if [ -e /etc/init.d/nginx ] && ( [ "$NGINX_WEBSERVER" -eq 1 ] || [ "$UPDATE_NGINX" -eq 1 ] ); then
+ if [ -e /etc/init.d/nginx ] && ([ "$NGINX_WEBSERVER" -eq 1 ] || [ "$UPDATE_NGINX" -eq 1 ]); then
NGINX_WEBSERVER=0
/etc/init.d/nginx restart
fi
fi
}
-err_out()
-{
+err_out() {
post_checks
exit 1
}
-int_out()
-{
+int_out() {
post_checks
trap - INT
kill -INT $$
}
-is_staging()
-{
+is_staging() {
local main_domain
local domain_dir
main_domain="$1"
return $?
}
-issue_cert()
-{
+issue_cert() {
local section="$1"
local acme_args=
local enabled
fi
fi
-
acme_args="$acme_args $(for d in $domains; do echo -n "-d $d "; done)"
acme_args="$acme_args --keylength $keylength"
[ -n "$ACCOUNT_EMAIL" ] && acme_args="$acme_args --accountemail $ACCOUNT_EMAIL"
local nginx_updated
nginx_updated=0
- if command -v nginx-util 2>/dev/null && [ "$update_nginx" -eq "1" ]; then
+ if command -v nginx-util 2> /dev/null && [ "$update_nginx" -eq "1" ]; then
nginx_updated=1
for domain in $domains; do
nginx-util add_ssl "${domain}" acme "${domain_dir}/fullchain.cer" \
post_checks
}
-load_vars()
-{
+load_vars() {
local section="$1"
STATE_DIR=$(config_get "$section" state_dir)