Add inadyn username and password if they don't exist

This commit is contained in:
Bob Mottram 2018-05-12 13:24:44 +01:00
parent 112ff52ad3
commit bd7f8b4a91
1 changed files with 10 additions and 2 deletions

View File

@ -129,10 +129,18 @@ function update_inadyn_config {
else
# change username/password for an existing provider
if [ "$DDNS_USERNAME" ]; then
sed -i "s| username .*| username $DDNS_USERNAME|g" /etc/inadyn.conf
if grep -q " username " /etc/inadyn.conf; then
sed -i "s| username .*| username $DDNS_USERNAME|g" /etc/inadyn.conf
else
echo " username $DDNS_USERNAME" >> /etc/inadyn.conf
fi
fi
if [ "$DDNS_PASSWORD" ]; then
sed -i "s| password .*| password $DDNS_PASSWORD|g" /etc/inadyn.conf
if grep -q " password " /etc/inadyn.conf; then
sed -i "s| password .*| password $DDNS_PASSWORD|g" /etc/inadyn.conf
else
echo " password $DDNS_PASSWORD" >> /etc/inadyn.conf
fi
fi
fi