Move to upgraded version of inadyn

This commit is contained in:
Bob Mottram 2018-05-12 17:48:20 +01:00
parent a3e6ce965c
commit ff0ba8b806
16 changed files with 181 additions and 117 deletions

View File

@ -110,7 +110,7 @@ function install_interactive_akaunting {
while [ ! $AKAUNTING_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ $DDNS_PROVIDER == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Akaunting Configuration" \
--form $"\\nPlease enter your Akaunting details.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
@ -142,7 +142,7 @@ function install_interactive_akaunting {
AKAUNTING_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ $DDNS_PROVIDER == *"freedns"* ]]; then
AKAUNTING_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$AKAUNTING_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -112,7 +112,7 @@ function install_interactive_gnusocial {
while [ ! $GNUSOCIAL_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ $DDNS_PROVIDER == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"GNU Social Configuration" \
--form $"\\nPlease enter your GNU Social details. The background image URL can be left blank.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
@ -156,7 +156,7 @@ function install_interactive_gnusocial {
GNUSOCIAL_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ $DDNS_PROVIDER == *"freedns"* ]]; then
GNUSOCIAL_CODE=$(sed -n 4p < "$data")
validate_freedns_code "$GNUSOCIAL_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -91,7 +91,7 @@ function install_interactive_kanboard {
while [ ! $KANBOARD_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ $DDNS_PROVIDER == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"KanBoard Configuration" \
--form $"\\nPlease enter your KanBoard details.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt." 13 55 2 \
@ -123,7 +123,7 @@ function install_interactive_kanboard {
KANBOARD_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
KANBOARD_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$KANBOARD_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -90,7 +90,7 @@ function install_interactive_koel {
while [ ! $KOEL_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Koel Configuration" \
--form $"\\nPlease enter your Koel details. The background image URL can be left blank.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 3 \
@ -122,7 +122,7 @@ function install_interactive_koel {
KOEL_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
KOEL_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$KOEL_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -79,7 +79,7 @@ function install_interactive_movim {
while [ ! $MOVIM_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Movim Configuration" \
--form $"\\nPlease enter your Movim details.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 12 65 2 \
@ -106,7 +106,7 @@ function install_interactive_movim {
MOVIM_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
MOVIM_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$MOVIM_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -90,7 +90,7 @@ function install_interactive_nextcloud {
while [ ! $NEXTCLOUD_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"NextCloud Configuration" \
--form $"\\nPlease enter your NextCloud details.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 13 65 3 \
@ -119,7 +119,7 @@ function install_interactive_nextcloud {
NEXTCLOUD_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
NEXTCLOUD_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$NEXTCLOUD_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -380,7 +380,7 @@ function install_interactive_pelican {
while [ ! $PELICAN_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Pelican Blog Configuration" \
--form $"\\nPlease enter your blog details.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
@ -412,7 +412,7 @@ function install_interactive_pelican {
PELICAN_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
PELICAN_BLOG_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$PELICAN_BLOG_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -335,7 +335,7 @@ function install_interactive_pleroma {
while [ ! $PLEROMA_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Pleroma Configuration" \
--form $"\\nPlease enter your Pleroma details. The background image URL can be left blank.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
@ -379,7 +379,7 @@ function install_interactive_pleroma {
PLEROMA_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
PLEROMA_CODE=$(sed -n 4p < "$data")
validate_freedns_code "$PLEROMA_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -118,7 +118,7 @@ function install_interactive_postactiv {
while [ ! $POSTACTIV_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"PostActiv Configuration" \
--form $"\\nPlease enter your PostActiv details. The background image URL can be left blank.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 16 65 4 \
@ -162,7 +162,7 @@ function install_interactive_postactiv {
POSTACTIV_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
POSTACTIV_CODE=$(sed -n 4p < "$data")
validate_freedns_code "$POSTACTIV_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -89,7 +89,7 @@ function install_interactive_privatebin {
while [ ! $PRIVATEBIN_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"PrivateBin Configuration" \
--form $"\\nPlease enter your PrivateBin details. The background image URL can be left blank.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 14 65 2 \
@ -121,7 +121,7 @@ function install_interactive_privatebin {
PRIVATEBIN_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
PRIVATEBIN_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$PRIVATEBIN_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -76,7 +76,7 @@ function install_interactive_riot {
while [ ! $RIOT_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Riot Web user interface for Matrix" \
--form $"\\nPlease enter your details.\\n\\nIMPORTANT: This should be a domain name which is supported by Let's Encrypt:" 13 65 3 \
@ -105,7 +105,7 @@ function install_interactive_riot {
RIOT_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
RIOT_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$RIOT_CODE"
if [ ! "$VALID_CODE" ]; then

View File

@ -184,7 +184,7 @@ function choose_social_instance_domain_name {
while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ "$DDNS_PROVIDER" == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Instance domain" \
--form $"\\nEnter your instance domain name and its FreeDNS code:" 11 55 3 \
@ -247,7 +247,7 @@ function choose_default_domain_name {
while [ ! $DEFAULT_DOMAIN_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ "$DDNS_PROVIDER" == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title $"Your main domain name on FreeDNS" \
--form $"\nWhich domain name should your email/XMPP/IRC/Mumble be associated with?" 13 55 5 \

View File

@ -80,32 +80,32 @@ function dynamic_dns_setup {
fi
case $selection in
1) DDNS_PROVIDER="default@freedns.afraid.org";;
2) DDNS_PROVIDER="default@www.dyn.com";;
3) DDNS_PROVIDER="default@www.zoneedit.com";;
4) DDNS_PROVIDER="default@www.no-ip.com";;
5) DDNS_PROVIDER="default@www.easydns.com";;
6) DDNS_PROVIDER="default@www.dnsomatic.com";;
7) DDNS_PROVIDER="default@dns.he.net";;
8) DDNS_PROVIDER="default@www.tunnelbroker.net";;
9) DDNS_PROVIDER="default@www.sitelutions.com";;
10) DDNS_PROVIDER="default@www.dnsexit.com";;
11) DDNS_PROVIDER="default@www.changeip.com";;
12) DDNS_PROVIDER="default@www.zerigo.com";;
13) DDNS_PROVIDER="default@www.dhis.org";;
14) DDNS_PROVIDER="default@nsupdate.info";;
15) DDNS_PROVIDER="default@www.loopia.com";;
16) DDNS_PROVIDER="default@www.namecheap.com";;
17) DDNS_PROVIDER="default@www.ovh.com";;
18) DDNS_PROVIDER="default@www.dtdns.com";;
19) DDNS_PROVIDER="default@giradns.com";;
20) DDNS_PROVIDER="default@www.duiadns.net";;
21) DDNS_PROVIDER="default@ddnss.de";;
22) DDNS_PROVIDER="default@dynv6.com";;
23) DDNS_PROVIDER="default@ipv4.dynv6.com";;
24) DDNS_PROVIDER="default@spdyn.de";;
25) DDNS_PROVIDER="default@freemyip.com";;
26) DDNS_PROVIDER="default@www.cloudxns.net";;
1) DDNS_PROVIDER="freedns";;
2) DDNS_PROVIDER="dyn";;
3) DDNS_PROVIDER="zoneedit.com";;
4) DDNS_PROVIDER="no-ip.com";;
5) DDNS_PROVIDER="easydns.com";;
6) DDNS_PROVIDER="dnsomatic.com";;
7) DDNS_PROVIDER="dns.he.net";;
8) DDNS_PROVIDER="tunnelbroker.net";;
9) DDNS_PROVIDER="sitelutions.com";;
10) DDNS_PROVIDER="dnsexit.com";;
11) DDNS_PROVIDER="changeip.com";;
12) DDNS_PROVIDER="zerigo.com";;
13) DDNS_PROVIDER="dhis.org";;
14) DDNS_PROVIDER="nsupdate.info";;
15) DDNS_PROVIDER="loopia.com";;
16) DDNS_PROVIDER="namecheap.com";;
17) DDNS_PROVIDER="ovh.com";;
18) DDNS_PROVIDER="dtdns.com";;
19) DDNS_PROVIDER="giradns.com";;
20) DDNS_PROVIDER="duiadns.net";;
21) DDNS_PROVIDER="ddnss.de";;
22) DDNS_PROVIDER="dynv6.com";;
23) DDNS_PROVIDER="ipv4.dynv6.com";;
24) DDNS_PROVIDER="spdyn.de";;
25) DDNS_PROVIDER="freemyip.com";;
26) DDNS_PROVIDER="cloudxns.net";;
esac
save_configuration_values

View File

@ -35,12 +35,12 @@ NAMESERVER5='85.25.251.254'
NAMESERVER6='2.141.58.13'
# parameters used when adding a new domain
DDNS_PROVIDER="default@freedns.afraid.org"
DDNS_PROVIDER="freedns"
DDNS_USERNAME=
DDNS_PASSWORD=
INADYN_REPO="https://github.com/bashrc/inadyn"
INADYN_COMMIT='fadbe17f520d337dfb8d69ee4bf1fcaa23fce0d6'
INADYN_REPO="https://github.com/troglobit/inadyn"
INADYN_COMMIT='3fe26d2235ddda9047cf33e8ed1453bcc3bbbf19'
INADYN_CONFIG_FILE=/etc/inadyn.conf
# web site used to obtain the external IP address of the system
@ -105,6 +105,13 @@ function update_inadyn_config {
fi
if ! grep -q "$DDNS_PROVIDER" "${INADYN_CONFIG_FILE}"; then
if grep -q "{" "${INADYN_CONFIG_FILE}"; then
sed -i "s|provider .*|provider $DDNS_PROVIDER {|g" "${INADYN_CONFIG_FILE}"
sed -i "s|username .*|username = $DDNS_USERNAME|g" "${INADYN_CONFIG_FILE}"
sed -i "s|password .*|password = $DDNS_PASSWORD|g" "${INADYN_CONFIG_FILE}"
sed -i "s|checkip-server .*|checkip-server = $GET_IP_ADDRESS_URL|g" "${INADYN_CONFIG_FILE}"
else
# Old inadyn config file format
# store any previous aliases
grep 'alias ' "${INADYN_CONFIG_FILE}" > /tmp/inadyn_aliases
@ -127,7 +134,14 @@ function update_inadyn_config {
cat /tmp/inadyn_aliases >> "${INADYN_CONFIG_FILE}"
rm /tmp/inadyn_aliases
fi
fi
else
if grep -q "{" "${INADYN_CONFIG_FILE}"; then
sed -i "s|username .*|username = $DDNS_USERNAME|g" "${INADYN_CONFIG_FILE}"
sed -i "s|password .*|password = $DDNS_PASSWORD|g" "${INADYN_CONFIG_FILE}"
sed -i "s|checkip-server .*|checkip-server = $GET_IP_ADDRESS_URL|g" "${INADYN_CONFIG_FILE}"
else
# Old inadyn config file format
# change username/password for an existing provider
if [ "$DDNS_USERNAME" ]; then
if grep -q " username " "${INADYN_CONFIG_FILE}"; then
@ -144,6 +158,7 @@ function update_inadyn_config {
fi
fi
fi
fi
systemctl enable inadyn
systemctl restart inadyn
@ -203,24 +218,29 @@ function add_ddns_domain {
exit 5745
fi
if ! grep -q "$DDNS_PROVIDER" "${INADYN_CONFIG_FILE}"; then
{ echo '';
echo "system $DDNS_PROVIDER";
echo ' ssl';
echo " checkip-url $GET_IP_ADDRESS_URL /"; } >> "${INADYN_CONFIG_FILE}"
if [ $DDNS_USERNAME ]; then
echo " username $DDNS_USERNAME" >> "${INADYN_CONFIG_FILE}"
fi
if [ $DDNS_PASSWORD ]; then
echo " password $DDNS_PASSWORD" >> "${INADYN_CONFIG_FILE}"
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 = { $CURRENT_DDNS_DOMAIN }";
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
echo " alias $CURRENT_DDNS_DOMAIN" >> "${INADYN_CONFIG_FILE}"
DDNS_HOSTNAMES=$(grep 'hostname ' "${INADYN_CONFIG_FILE}"| awk -F '{' '{print $2}' | sed 's| }||g')
sed -i "s|hostname .*|hostname = {${DDNS_HOSTNAMES}, ${CURRENT_DDNS_DOMAIN} }|g" "${INADYN_CONFIG_FILE}"
fi
chmod 600 "${INADYN_CONFIG_FILE}"
systemctl restart inadyn
systemctl daemon-reload
systemctl restart inadyn
}
function remove_ddns_domain {
@ -241,9 +261,12 @@ function remove_ddns_domain {
fi
if grep -q "$CURRENT_DDNS_DOMAIN" "${INADYN_CONFIG_FILE}"; then
systemctl stop inadyn
sed -i "/alias $CURRENT_DDNS_DOMAIN/d" "${INADYN_CONFIG_FILE}"
systemctl start 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
}

View File

@ -126,7 +126,7 @@ function interactive_site_details {
while [ ! $SITE_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ $DDNS_PROVIDER == "freedns" ]]; then
dialog --backtitle "$SITE_BACKTITLE" \
--title "$SITE_CONFIG_TITLE" \
--form "$SITE_FORM_TEXT" 14 55 3 \
@ -155,7 +155,7 @@ function interactive_site_details {
SITE_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ "$DDNS_PROVIDER" == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
SITE_CODE=$(sed -n 2p < "$data")
validate_freedns_code "$SITE_CODE"
if [ ! "$VALID_CODE" ]; then
@ -193,7 +193,7 @@ function interactive_site_details_with_title {
while [ ! $SITE_DETAILS_COMPLETE ]
do
data=$(mktemp 2>/dev/null)
if [[ $DDNS_PROVIDER == "default@freedns.afraid.org" ]]; then
if [[ $DDNS_PROVIDER == *"freedns"* ]]; then
dialog --backtitle $"Freedombone Configuration" \
--title "$SITE_BACKTITLE" \
--form "$SITE_FORM_TEXT" 14 55 4 \
@ -225,7 +225,7 @@ function interactive_site_details_with_title {
SITE_DOMAIN_NAME=
dialog --title $"Domain name validation" --msgbox "$TEST_DOMAIN_NAME" 15 50
else
if [[ "$DDNS_PROVIDER" == "default@freedns.afraid.org" ]]; then
if [[ "$DDNS_PROVIDER" == *"freedns"* ]]; then
SITE_CODE=$(sed -n 3p < "$data")
validate_freedns_code "${SITE_CODE}"
if [ ! "$VALID_CODE" ]; then

View File

@ -430,6 +430,46 @@ function install_web_server_access_control {
fi
}
function upgrade_inadyn_config {
if [ ! -f "${INADYN_CONFIG_FILE}" ]; then
return
fi
if grep -q "{" "${INADYN_CONFIG_FILE}"; then
return
fi
read_config_param DDNS_PROVIDER
read_config_param DDNS_USERNAME
read_config_param DDNS_PASSWORD
grep "alias " "${INADYN_CONFIG_FILE}" | sed 's| alias ||g' > ~/.inadyn_existing_sites
DDNS_HOSTNAMES=
while read -r host; do
if [ "$DDNS_HOSTNAMES" ]; then
DDNS_HOSTNAMES="$DDNS_HOSTNAMES, $host"
else
DDNS_HOSTNAMES="$host"
fi
done <~/.inadyn_existing_sites
if [ ! "$DDNS_HOSTNAMES" ]; then
return
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 '}'; } > "${INADYN_CONFIG_FILE}"
}
function install_dynamicdns {
if [[ $SYSTEM_TYPE == "mesh"* ]]; then
return
@ -458,6 +498,7 @@ function install_dynamicdns {
# https version 1.99.8
apt-get -yq install build-essential curl libgnutls28-dev automake1.11
apt-get -yq install gnutls-dev libconfuse-dev
if [ ! -d "$INSTALL_DIR/inadyn" ]; then
if [ -d /repos/inadyn ]; then
mkdir "$INSTALL_DIR/inadyn"
@ -477,47 +518,47 @@ function install_dynamicdns {
git checkout "$INADYN_COMMIT" -b "$INADYN_COMMIT"
set_completion_param "inadyn commit" "$INADYN_COMMIT"
#./autogen.sh
if ! ./configure; then
./autogen.sh
if ! ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-openssl; then
exit 74890
fi
if ! USE_OPENSSL=1 make; then
if ! make -j5; then
exit 74858
fi
if ! make install; then
if ! make install-strip; then
exit 3785
fi
# create an unprivileged user
#chmod 600 /etc/shadow
#chmod 600 /etc/gshadow
#useradd -r -s /bin/false debian-inadyn
#chmod 0000 /etc/shadow
#chmod 0000 /etc/gshadow
# create a configuration file
{ echo 'background';
echo 'verbose 1';
echo 'period 300';
echo 'startup-delay 60';
echo 'cache-dir /run/inadyn';
echo 'logfile /dev/null'; } > /etc/inadyn.conf
chmod 600 /etc/inadyn.conf
echo 'logfile /dev/null'; } > "${INADYN_CONFIG_FILE}"
chmod 600 "${INADYN_CONFIG_FILE}"
{ echo '[Unit]';
echo 'Description=inadyn (DynDNS updater)';
echo 'After=network.target';
echo '';
echo '[Service]';
echo 'ExecStart=/usr/local/sbin/inadyn --config /etc/inadyn.conf';
echo "ExecStart=/usr/sbin/inadyn --config ${INADYN_CONFIG_FILE}";
echo 'Restart=always';
echo 'Type=forking';
echo '';
echo '[Install]';
echo 'WantedBy=multi-user.target'; } > /etc/systemd/system/inadyn.service
systemctl enable inadyn
systemctl start inadyn
systemctl daemon-reload
systemctl start inadyn
# Remove old version of inadyn
if [ -f /usr/local/sbin/inadyn ]; then
rm /usr/local/sbin/inadyn
upgrade_inadyn_config
fi
mark_completed "${FUNCNAME[0]}"
}