diff --git a/DEBIAN/postinst b/DEBIAN/postinst index a0e7334..2311b35 100644 --- a/DEBIAN/postinst +++ b/DEBIAN/postinst @@ -37,9 +37,10 @@ EOF systemctl daemon-reload -echo "> Writing default config parameters ..." -touch $CONFIG_DIR/env -cat <$CONFIG_DIR/env +if [[ ! -f $CONFIG_DIR/env ]]; then + echo "> Writing initial config ..." + touch $CONFIG_DIR/env + cat <$CONFIG_DIR/env DLS_URL=127.0.0.1 DLS_PORT=443 LEASE_EXPIRE_DAYS=90 @@ -48,6 +49,7 @@ INSTANCE_KEY_RSA=$CONFIG_DIR/instance.private.pem INSTANCE_KEY_PUB=$CONFIG_DIR/instance.public.pem EOF +fi echo "> Create dls-instance keypair ..." openssl genrsa -out $CONFIG_DIR/instance.private.pem 2048 @@ -72,7 +74,8 @@ if [[ -f $CONFIG_DIR/webserver.key ]]; then if [ -x "$(command -v curl)" ]; then echo "> Testing API ..." - curl --insecure -X GET https://127.0.0.1/status + source $CONFIG_DIR/env + curl --insecure -X GET https://$DLS_URL:$DLS_PORT/status else echo "> Testing API failed, curl not available. Please test manually!" fi