[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: /etc/init.d/network is too simple?



On Fri, Apr 16, 1999 at 07:00:27PM +0200, Piotr Roszatycki wrote:
> > Reallty there should be separate files, perhaps in /etc/network
> > which consist solely of variable definitions:
> > say: 
> > 
> > /etc/network/eth1
> > IPADDR=192.168.217.1
> > NETMASK=255.255.255.0
> > NETWORK=
> > BROADCAST=
> 
> Well, this is very similar to RH configuration.
> The power of Debian is using of basic commands:
> ifconfig eth1 192.168.217.1 .....
> 
> I don't see a need of using shell variables because there is no 
> configurator which reads this configuration.


--- /etc/init.d/network
#!/bin/sh

case i in
start,stop)
  for i in /etc/network/*; do
    if [ -x $i ]; then
      $i ${1}
    fi
  done
;;
*)
  echo '$1 needs to be start or stop you twit!'
  exit 1
;;
esac
---

We make sure $1 is safe and if it's not we don't run anything to save
needless error messages.

--- /etc/network/eth1
#!/bin/sh

INTERFACE=eth1
IPADDR=192.168.217.1
NETMASK=255.255.255.0
NETWORK=
BROADCAST=

case $1 of
start)
  ifconfig $INTERFACE $IPADDR netmask $NETMASK
  route add -net ${NETWORK}
;;
stop)
  route del -net ${NETWORK}
  ifconfig $INTERFACE down
;;
*)
  echo '$1 needs to be start or stop you twit!'
  exit 1
;;
esac
---

Actually, it's possible that the above should be modified so it supports
DHCP or whatever too.  Of course none of this is tested and it needs nice
formatted output and I'm not the best with sh, but it's at least a
conceptual thing...

I couldn't use run-parts because I couldn't pass the start/stop that way.

--
Joseph Carter <knghtbrd@debian.org>            Debian GNU/Linux developer
PGP: E8D68481E3A8BB77 8EE22996C9445FBE            The Source Comes First!
-------------------------------------------------------------------------
While the year 2000 (y2k) problem is not an issue for us, all Linux
implementations will impacted by the year 2038 (y2.038k) issue. The
Debian Project is committed to working with the industry on this issue
and we will have our full plans and strategy posted by the first quarter
of 2020.

Attachment: pgpCcfZmLTwdm.pgp
Description: PGP signature


Reply to: