#!/bin/sh #--------------------------------------------------------------------------- # /etc/rc.d/rc540.dyndns - write config for dyndns # part of Package DYNDNS __FLI4LVER__, see documentation for licence # # (c) copyright 2001-2002 Thomas Mueller # (c) copyright 2002-2003 Tobias Gruetzmacher # # Created by: Thomas Mueller # Last change: $Id$ #---------------------------------------------------------------------------- case $OPT_DYNDNS in yes) begin_script DYNDNS "Setting up dynamic hostname configuration ..." [ "$DYNDNS_ALLOW_SSL" = yes ] && > /etc/dyndns/allow_ssl [ "$DYNDNS_DEBUG_PROVIDER" = yes ] && > /etc/dyndns/debug_provider [ "$DYNDNS_LOOKUP_NAMES" = yes ] && > /etc/dyndns/lookup_names # Write config > /etc/dyndns/dyndns.conf # Make the config (with the passwords!) only readable by root chmod 600 /etc/dyndns/dyndns.conf [ 0$DYNDNS_N -eq 0 ] || for idx in `seq 1 $DYNDNS_N`; do # get config entries for provider idx eval provider='$DYNDNS_'$idx'_PROVIDER' eval user='$DYNDNS_'$idx'_USER' eval pass='$DYNDNS_'$idx'_PASSWORD' eval host='$DYNDNS_'$idx'_HOSTNAME' eval circ='$DYNDNS_'$idx'_CIRCUIT' eval renew='$DYNDNS_'$idx'_RENEW' eval extip='$DYNDNS_'$idx'_EXT_IP' : ${extip:=no} sep= circuits= for c in $circ; do if [ -f /var/run/circuit-$c ]; then circuits="$circuits$sep$c" sep=, else log_error "Invalid circuit '$c' for $host (DYNDNS_$idx), ignoring circuit" fi done if [ "$circuits" ]; then echo "$host $provider $circuits $user $pass $extip $renew " >> /etc/dyndns/dyndns.conf else log_error "No valid circuit for $host (DYNDNS_$idx), ignoring entry" fi done # Create directories for logging, history and registered IPs mkdir -p /var/log/dyndns /var/log/dyndns/history /var/run/dyndns chmod a+r /var/log/dyndns /var/log/dyndns/history if [ "$OPT_HTTPD$DYNDNS_SAVE_OUTPUT" = 'yesyes' ]; then httpd-menu.sh add -p 900 status_dyndns.cgi "DynDNS" '$_MT_stat' dyndns [ "$DYNDNS_DEBUG_PROVIDER" = yes ] && httpd-menu.sh add -p 910 'status_dyndns.cgi?action=debug_provider' "DynDNS-Debug" Debug dyndns fi end_script ;; esac