forked from oscar.krause/fastapi-dls
migrated "[[ ]]" if statements to "[ ]"
This commit is contained in:
parent
7ef071f92b
commit
d69d833923
@ -3,7 +3,7 @@
|
|||||||
WORKING_DIR=/usr/share/fastapi-dls
|
WORKING_DIR=/usr/share/fastapi-dls
|
||||||
CONFIG_DIR=/etc/fastapi-dls
|
CONFIG_DIR=/etc/fastapi-dls
|
||||||
|
|
||||||
if [[ ! -f $CONFIG_DIR/instance.private.pem ]]; then
|
if [ ! -f $CONFIG_DIR/instance.private.pem ]; then
|
||||||
echo "> Create dls-instance keypair ..."
|
echo "> Create dls-instance keypair ..."
|
||||||
openssl genrsa -out $CONFIG_DIR/instance.private.pem 2048
|
openssl genrsa -out $CONFIG_DIR/instance.private.pem 2048
|
||||||
openssl rsa -in $CONFIG_DIR/instance.private.pem -outform PEM -pubout -out $CONFIG_DIR/instance.public.pem
|
openssl rsa -in $CONFIG_DIR/instance.private.pem -outform PEM -pubout -out $CONFIG_DIR/instance.public.pem
|
||||||
@ -12,8 +12,8 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
[[ -f $CONFIG_DIR/webserver.key ]] && default_answer="N" || default_answer="Y"
|
[ -f $CONFIG_DIR/webserver.key ] && default_answer="N" || default_answer="Y"
|
||||||
[[ $default_answer == "Y" ]] && V="Y/n" || V="y/N"
|
[ $default_answer == "Y" ] && V="Y/n" || V="y/N"
|
||||||
read -p "> Do you wish to create self-signed webserver certificate? [${V}]" yn
|
read -p "> Do you wish to create self-signed webserver certificate? [${V}]" yn
|
||||||
yn=${yn:-$default_answer} # ${parameter:-word} If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
|
yn=${yn:-$default_answer} # ${parameter:-word} If parameter is unset or null, the expansion of word is substituted. Otherwise, the value of parameter is substituted.
|
||||||
case $yn in
|
case $yn in
|
||||||
@ -27,7 +27,7 @@ while true; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -f $CONFIG_DIR/webserver.key ]]; then
|
if [ -f $CONFIG_DIR/webserver.key ]; then
|
||||||
echo "> Starting service ..."
|
echo "> Starting service ..."
|
||||||
systemctl start fastapi-dls.service
|
systemctl start fastapi-dls.service
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
if [[ -f /etc/systemd/system/fastapi-dls.service ]]; then
|
if [ -f /etc/systemd/system/fastapi-dls.service ]; then
|
||||||
echo "> Removing service file."
|
echo "> Removing service file."
|
||||||
rm /etc/systemd/system/fastapi-dls.service
|
rm /etc/systemd/system/fastapi-dls.service
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user