mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-07-03 04:28:45 +02:00
Update 30-keygen
This commit is contained in:
@@ -7,11 +7,13 @@ if bashio::config.true 'use_own_certs'; then
|
|||||||
KEYFILE=$(bashio::config 'keyfile')
|
KEYFILE=$(bashio::config 'keyfile')
|
||||||
|
|
||||||
#Check if files exist
|
#Check if files exist
|
||||||
[ ! -f /ssl/$CERTFILE ] && bashio::log.fatal "... Certificate /ssl/$CERTFILE not found" && exit 1
|
echo "... checking if referenced files exist"
|
||||||
[ ! -f /ssl/$KEYFILE ] && bashio::log.fatal "... Certificate /ssl/$KEYFILE not found" && exit 1
|
[ ! -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
|
#Sets certificates
|
||||||
NGINXFILE="/defaults/default"
|
echo "... adding ssl certs in files"
|
||||||
|
NGINXFILE="/defaults/default"
|
||||||
LINE=$(sed -n '/cert.crt/=' $NGINXFILE)
|
LINE=$(sed -n '/cert.crt/=' $NGINXFILE)
|
||||||
sed -i "$LINE a ssl_certificate ${CERTFILE};" $NGINXFILE
|
sed -i "$LINE a ssl_certificate ${CERTFILE};" $NGINXFILE
|
||||||
sed -i "$LINE d" $NGINXFILE
|
sed -i "$LINE d" $NGINXFILE
|
||||||
@@ -25,14 +27,14 @@ NGINXFILE="/config/nginx/site-confs/default"
|
|||||||
if [ -f $NGINXFILE ]; then
|
if [ -f $NGINXFILE ]; then
|
||||||
LINE=$(sed -n '/cert.crt/=' $NGINXFILE) && \
|
LINE=$(sed -n '/cert.crt/=' $NGINXFILE) && \
|
||||||
sed -i "$LINE a ssl_certificate ${CERTFILE};" $NGINXFILE && \
|
sed -i "$LINE a ssl_certificate ${CERTFILE};" $NGINXFILE && \
|
||||||
sed -i "$LINE d" $NGINXFILE || true
|
sed -i "$LINE d" $NGINXFILE
|
||||||
fi || true
|
fi
|
||||||
|
|
||||||
if [ -f $NGINXFILE ]; then
|
if [ -f $NGINXFILE ]; then
|
||||||
LINE=$(sed -n '/cert.key/=' $NGINXFILE) && \
|
LINE=$(sed -n '/cert.key/=' $NGINXFILE) && \
|
||||||
sed -i "$LINE a ssl_certificate_key ${CERTFILE};" $NGINXFILE && \
|
sed -i "$LINE a ssl_certificate_key ${CERTFILE};" $NGINXFILE && \
|
||||||
sed -i "$LINE d" $NGINXFILE || true
|
sed -i "$LINE d" $NGINXFILE
|
||||||
fi || true
|
fi
|
||||||
|
|
||||||
bashio::log.info "... done"
|
bashio::log.info "... done"
|
||||||
echo "#!/bin/bash" > /etc/cont-init.d/30-keygen
|
echo "#!/bin/bash" > /etc/cont-init.d/30-keygen
|
||||||
|
|||||||
Reference in New Issue
Block a user