Fixing inadyn around using a wildcarded default domain name

This commit is contained in:
Bob Mottram 2018-05-12 21:41:54 +01:00
parent 5a24012929
commit fe6f27c9d4
3 changed files with 20 additions and 23 deletions

View File

@ -1691,7 +1691,6 @@ image_install_inadyn() {
# create a configuration file
{ echo 'period = 300';
echo 'user-agent = Mozilla/5.0';
echo ''; } > "$rootdir/etc/inadyn.conf"
chmod 600 "$rootdir/etc/inadyn.conf"
@ -1706,7 +1705,9 @@ image_install_inadyn() {
echo '';
echo '[Service]';
echo 'Type=simple';
echo "ExecStart=/usr/sbin/inadyn -n -s --config ${INADYN_CONFIG_FILE}";
echo "ExecStart=/usr/sbin/inadyn -C -n -s --loglevel=err --config ${INADYN_CONFIG_FILE}";
echo 'Restart=on-failure';
echo 'RestartSec=10';
echo '';
echo '[Install]';
echo 'WantedBy=multi-user.target'; } > "$rootdir/etc/systemd/system/inadyn.service"

View File

@ -218,19 +218,15 @@ function add_ddns_domain {
exit 5745
fi
if ! grep -q "$DDNS_PROVIDER" "${INADYN_CONFIG_FILE}"; then
read_config_param DEFAULT_DOMAIN_NAME
{ echo 'period = 300';
echo 'user-agent = Mozilla/5.0';
echo '';
echo "provider $DDNS_PROVIDER {";
echo " ssl = true";
echo " checkip-ssl = false";
echo " checkip-server = $GET_IP_ADDRESS_URL";
echo " username = $DDNS_USERNAME";
echo " password = $DDNS_PASSWORD";
echo " hostname = { $CURRENT_DDNS_DOMAIN }";
echo " hostname = $DEFAULT_DOMAIN_NAME";
echo '}'; } > "${INADYN_CONFIG_FILE}"
else
sed -i "s|checkip-server .*|checkip-server = $GET_IP_ADDRESS_URL|g" "${INADYN_CONFIG_FILE}"
fi
if ! grep -q "$CURRENT_DDNS_DOMAIN" "${INADYN_CONFIG_FILE}"; then
@ -259,15 +255,15 @@ function remove_ddns_domain {
echo $'Unable to find inadyn configuration file "${INADYN_CONFIG_FILE}"'
exit 5745
fi
if grep -q "$CURRENT_DDNS_DOMAIN" "${INADYN_CONFIG_FILE}"; then
systemctl stop inadyn
sed -i "s|, ${CURRENT_DDNS_DOMAIN}||g" "${INADYN_CONFIG_FILE}"
if grep -q "$CURRENT_DDNS_DOMAIN" "${INADYN_CONFIG_FILE}"; then
sed -i "s|${CURRENT_DDNS_DOMAIN}||g" "${INADYN_CONFIG_FILE}"
fi
systemctl daemon-reload
systemctl start inadyn
fi
#if grep -q "$CURRENT_DDNS_DOMAIN" "${INADYN_CONFIG_FILE}"; then
# systemctl stop inadyn
# sed -i "s|, ${CURRENT_DDNS_DOMAIN}||g" "${INADYN_CONFIG_FILE}"
# if grep -q "$CURRENT_DDNS_DOMAIN" "${INADYN_CONFIG_FILE}"; then
# sed -i "s|${CURRENT_DDNS_DOMAIN}||g" "${INADYN_CONFIG_FILE}"
# fi
# systemctl daemon-reload
# systemctl start inadyn
#fi
}
function configure_dns {

View File

@ -446,6 +446,7 @@ function upgrade_inadyn_config {
read_config_param DDNS_PROVIDER
read_config_param DDNS_USERNAME
read_config_param DDNS_PASSWORD
read_config_param DEFAULT_DOMAIN_NAME
grep "alias " "${INADYN_CONFIG_FILE}" | sed 's| alias ||g' > ~/.inadyn_existing_sites
DDNS_HOSTNAMES=
@ -467,15 +468,13 @@ function upgrade_inadyn_config {
fi
{ echo 'period = 300';
echo 'user-agent = Mozilla/5.0';
echo '';
echo "provider $DDNS_PROVIDER {";
echo " ssl = true";
echo " checkip-ssl = false";
echo " checkip-server = $GET_IP_ADDRESS_URL";
echo " username = $DDNS_USERNAME";
echo " password = $DDNS_PASSWORD";
echo " hostname = { $DDNS_HOSTNAMES }";
echo ' wildcard = true';
echo " hostname = $DEFAULT_DOMAIN_NAME";
echo '}'; } > "${INADYN_CONFIG_FILE}"
}
@ -562,7 +561,6 @@ function install_dynamicdns {
# create a configuration file
if [ ! -f "${INADYN_CONFIG_FILE}" ]; then
{ echo 'period = 300';
echo 'user-agent = Mozilla/5.0';
echo ''; } > "${INADYN_CONFIG_FILE}"
fi
chmod 600 "${INADYN_CONFIG_FILE}"
@ -578,7 +576,9 @@ function install_dynamicdns {
echo '';
echo '[Service]';
echo 'Type=simple';
echo "ExecStart=/usr/sbin/inadyn -n -s --config ${INADYN_CONFIG_FILE}";
echo "ExecStart=/usr/sbin/inadyn -C -n -s --loglevel=err --config ${INADYN_CONFIG_FILE}";
echo 'Restart=on-failure';
echo 'RestartSec=10';
echo '';
echo '[Install]';
echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/inadyn.service