From 0a07730db80408ce8c3d52c0023bb19264277897 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Wed, 27 Oct 2021 14:20:24 +0200 Subject: [PATCH] Update 30-keygen --- nextcloud/root/etc/cont-init.d/30-keygen | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nextcloud/root/etc/cont-init.d/30-keygen b/nextcloud/root/etc/cont-init.d/30-keygen index b14e54142..9cfa7edaa 100644 --- a/nextcloud/root/etc/cont-init.d/30-keygen +++ b/nextcloud/root/etc/cont-init.d/30-keygen @@ -7,11 +7,13 @@ if bashio::config.true 'use_own_certs'; then KEYFILE=$(bashio::config 'keyfile') #Check if files exist - [ ! -f /ssl/$CERTFILE ] && bashio::log.fatal "... Certificate /ssl/$CERTFILE not found" && exit 1 - [ ! -f /ssl/$KEYFILE ] && bashio::log.fatal "... Certificate /ssl/$KEYFILE not found" && exit 1 + echo "... checking if referenced files exist" + [ ! -f /ssl/$CERTFILE ] && bashio::log.fatal "... Certificate /ssl/$CERTFILE not found" && exit 0 + [ ! -f /ssl/$KEYFILE ] && bashio::log.fatal "... Certificate /ssl/$KEYFILE not found" && exit 0 #Sets certificates -NGINXFILE="/defaults/default" + echo "... adding ssl certs in files" + NGINXFILE="/defaults/default" LINE=$(sed -n '/cert.crt/=' $NGINXFILE) sed -i "$LINE a ssl_certificate ${CERTFILE};" $NGINXFILE sed -i "$LINE d" $NGINXFILE @@ -25,14 +27,14 @@ NGINXFILE="/config/nginx/site-confs/default" if [ -f $NGINXFILE ]; then LINE=$(sed -n '/cert.crt/=' $NGINXFILE) && \ sed -i "$LINE a ssl_certificate ${CERTFILE};" $NGINXFILE && \ - sed -i "$LINE d" $NGINXFILE || true -fi || true + sed -i "$LINE d" $NGINXFILE +fi if [ -f $NGINXFILE ]; then LINE=$(sed -n '/cert.key/=' $NGINXFILE) && \ sed -i "$LINE a ssl_certificate_key ${CERTFILE};" $NGINXFILE && \ - sed -i "$LINE d" $NGINXFILE || true -fi || true + sed -i "$LINE d" $NGINXFILE +fi bashio::log.info "... done" echo "#!/bin/bash" > /etc/cont-init.d/30-keygen