postinst improvements

This commit is contained in:
Oscar Krause 2022-12-28 09:04:35 +01:00
parent 2340931a60
commit b22613c337

View File

@ -37,9 +37,10 @@ EOF
systemctl daemon-reload
echo "> Writing default config parameters ..."
touch $CONFIG_DIR/env
cat <<EOF >$CONFIG_DIR/env
if [[ ! -f $CONFIG_DIR/env ]]; then
echo "> Writing initial config ..."
touch $CONFIG_DIR/env
cat <<EOF >$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