--- bin/prepare_fwupgrade.orig	2007-06-08 13:17:04.000000000 +0200
+++ bin/prepare_fwupgrade	2007-06-25 11:56:01.000000000 +0200
@@ -38,7 +38,7 @@
 voipd -s
 avmike -s
 killall printserv
-/sbin/igdd -s
+[ -x /sbin/igdd ] && /sbin/igdd -s
 usermand -s
 if [ "$1" = "start_from_internet" ] ; then
 # we will download the update image from the internet so
@@ -96,6 +96,7 @@
 killall avmike
 killall dsld
 killall websrv
+[ -x /etc/init.d/rc.websrv ] && /etc/init.d/rc.websrv stop 2> /dev/null
 killall wpa_authenticator
 killall wstart
 /sbin/multid -s
@@ -109,6 +110,7 @@
 killall -9 dsld
 killall -9 thttpd
 killall -9 websrv
+[ -x /etc/init.d/rc.websrv ] && /etc/init.d/rc.websrv kill 2> /dev/null
 killall -9 wpa_authenticator
 killall -9 wstart
 killall -9 multid
--- etc/init.d/rc.net.orig	2007-06-25 11:56:01.000000000 +0200
+++ etc/init.d/rc.net	2007-06-25 11:56:01.000000000 +0200
@@ -51,8 +51,26 @@
    WLAN_TEST=0
 fi
 
+# Do we have a websrv or was ist stripped from the firmware?
+_websrv=$(basename $(which websrv) 2> /dev/null)
+# Do we have a UPnP server (igdd) or was ist stripped from the firmware?
+_igdd=$(basename $(which igdd) 2> /dev/null)
+# Does a multid option to start without UPnP device (-u) exist?
+_multid_upnp=$(/sbin/multid -? 2>&1 | grep upnp)
+# Does a dsld option to start without igd (-g) exist?
+_dsld_upnp=$(/sbin/dsld -? 2>&1 | grep igd)
+# Set multid "no UPnP" option, if
+#   a) it has the parameter at all AND
+#   b) igdd binary does *not* exist
+[ "$_multid_upnp" ] && [ ! "$_igdd" ] && MULTIDPARAM="-u"
+# Set dsld "no igd" option, if
+#   a) it has the parameter at all AND
+#   b) igdd binary does *not* exist
+[ "$_dsld_upnp" ] && [ ! "$_igdd" ] && DSLDDPARAM="-g"
+
 igddstart()
 {
+   [ "$_igdd" ] || return;
    if [ "`pidof igdd`" = "" ] ; then
       igdd $VERBOSEPARAM
       sleep 1
@@ -209,14 +227,15 @@
 stopall()
 {
    if [ "$CONFIG_DSL" ] ; then
-      AVMDAEMONS="avmike dsld igdd websrv multid"
+      AVMDAEMONS="avmike dsld $_igdd $_websrv multid"
    else
-      AVMDAEMONS="igdd websrv multid"
+      AVMDAEMONS="$_igdd $_websrv multid"
    fi
    DAEMONS=
    for i in $AVMDAEMONS ; do
     eval $i -s
    done
+   [ "$_websrv" ] || /etc/init.d/rc.websrv stop
    sleep 3
    for i in $DAEMONS $AVMDAEMONS ; do
      killall -15 $i
@@ -266,9 +272,15 @@
      ctlmgr $NICEPARAM $VERBOSEPARAM
    fi
 
+   if [ "$_websrv" ]; then
    if [ "`pidof websrv`" = "" ] ; then
      websrv $NICEPARAM
    fi
+   else
+     if [ "$(/etc/init.d/rc.websrv status)" == "stopped" ]; then
+       /etc/init.d/rc.websrv start
+     fi
+   fi
    fi 
 
    igddstart
@@ -277,9 +302,9 @@
    if [ "$CONFIG_DSL" ] ; then
      if [ "`pidof dsld`" = "" ] ; then
        if [ "$CONFIG_RAMSIZE" = 8 ] ; then
-         dsld -i -n $NICEPARAM -r 600 $VERBOSEPARAM
+         dsld -i -n $NICEPARAM -r 600 $VERBOSEPARAM $DSLDDPARAM
        else
-         dsld -i -n $NICEPARAM $VERBOSEPARAM
+         dsld -i -n $NICEPARAM $VERBOSEPARAM $DSLDDPARAM
        fi
      fi
    fi
@@ -321,9 +333,9 @@
       if [ "$1" ] ; then
          AVMDAEMONS="$*"
       elif [ "$CONFIG_DSL" ] ; then
-         AVMDAEMONS="avmike dsld igdd multid"
+         AVMDAEMONS="avmike dsld $_igdd multid"
       else
-         AVMDAEMONS="igdd multid"
+         AVMDAEMONS="$_igdd multid"
       fi
 
       # stop the daemon with -s
