~ubuntu-branches/ubuntu/warty/dnprogs/warty

« back to all changes in this revision

Viewing changes to scripts/decnet.sh

  • Committer: Bazaar Package Importer
  • Author(s): Patrick Caulfield
  • Date: 2004-05-30 10:13:57 UTC
  • Revision ID: james.westby@ubuntu.com-20040530101357-1geqhhh0teccu0cm
Tags: 2.27
* Fix signal handling in sethost so it doesn't die with an embarrassing
  "Alarm clock" message.
* Add dependancy on modutils. Closes: #251508

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#
5
5
# Starts/Stops DECnet processes
6
6
#
7
 
# This script should go in /etc/init.d      (Debian)
8
 
#                          /etc/rc.d/init.d (RedHat)
9
 
#                          /sbin/init.d     (SuSE)
10
 
#
11
 
# and you should link to it from the relevant runlevel startup directory
12
 
# eg: (Debian)
13
 
#      update-rc.d start 39 S .  stop 11 1 .
14
 
#
15
 
#     (RedHat)
16
 
#      ln -s /etc/rc.d/init.d/decnet /etc/rc.d/rc3.d/S09decnet
17
 
#
18
 
#     (SuSE)
19
 
#      ln -s /sbin/init.d/decnet.sh /sbin/init.d/rc2.d/S05decnet
20
 
#
21
 
#     (Caldera)
22
 
#      ln -s /etc/rc.d/init.d/decnet /etc/rc.d/rc5.d/S01decnet
23
 
#
24
 
# This script MUST be run before TCP/IP is started unless you have a DEC
25
 
# TULIP based ethernet card AND are running Linux 2.2
 
7
# chkconfig: - 09 91
 
8
# description:  DECnet.
 
9
# processname: dnetd
 
10
# config: /etc/decnet.conf
 
11
#
 
12
#
 
13
# This script should go in
 
14
#  /etc/init.d for redhat 7.0 onwards
 
15
#  /etc/rc.d/init.d for redhat up to 6.2
 
16
#
 
17
# You can install it using the following command:
 
18
#
 
19
# chkconfig --level 345 decnet on
26
20
#
27
21
# -----------------------------------------------------------------------------
28
22
#
29
23
# Daemons to start. You may remove the ones you don't want
30
24
#
 
25
daemons="dnetd phoned"
 
26
 
 
27
# Prefix for where the progs are installed. "make install" puts them
 
28
# in /usr/local, the RPM has them in /usr
31
29
prefix=/usr/local
32
 
daemons="dnetd phoned"
33
 
 
34
 
#
35
 
# Interfaces to set the MAC address of. If empty all available
36
 
# ethernet interfaces will have their MAC address set the the DECnet
37
 
# address. If you do not want to do that (or don't want to do it here)
38
 
# then remove the -hw switch from the command.
39
 
#
40
 
# If running on Caldera OpenLinux you may need to add the -f switch to
41
 
# startnet to force it to change the MAC address because that 
42
 
# distribution's startup scripts UP all the interfaces before calling any
43
 
# other scripts :-(
44
 
#
45
 
interfaces=""
46
 
 
47
 
startnet="$prefix/sbin/startnet -hw $interfaces"
48
 
 
49
 
#
50
 
# See which distribution we are using and customise the start/stop 
51
 
# commands and the console display.
52
 
#
53
 
if [ -d /var/lib/dpkg ]
54
 
then
55
 
  # Debian
56
 
  startcmd="start-stop-daemon --start --quiet --exec"
57
 
  stopcmd="start-stop-daemon --stop --quiet --exec"
58
 
  startecho="\$i"
59
 
  startendecho="."
60
 
  stopendecho="done."
61
 
elif [ -d /var/lib/YaST ]
62
 
then
63
 
  # SuSE
64
 
  . /etc/rc.config
65
 
  startcmd=""
66
 
  stopcmd="killproc -TERM"
67
 
  startendecho=""
68
 
  stopendecho="done."
69
 
else
70
 
  # Assume RedHat
71
 
  . /etc/rc.d/init.d/functions
72
 
  startcmd="daemon"
73
 
  stopcmd="killproc"
74
 
  startendecho=""
75
 
  stopendecho="done."
76
 
fi
 
30
 
 
31
#
 
32
# Interfaces to set the MAC address of. By default only the default interface
 
33
# in /etc/decnet.conf will be set. If you want to set up more interfaces
 
34
# for DECnet than add them here.
 
35
#
 
36
extra_interfaces=""
 
37
 
 
38
#
 
39
# Set up some variables.
 
40
#
 
41
. /etc/rc.d/init.d/functions
 
42
startcmd="daemon"
 
43
stopcmd="killproc"
 
44
startendecho=""
 
45
stopendecho="done."
77
46
 
78
47
case $1 in
79
48
   start)
94
63
       fi
95
64
     fi
96
65
 
97
 
     echo -n "Starting DECnet: " 
 
66
     echo -n "Starting DECnet: "
98
67
 
99
 
     # Run startnet only if we need to
100
 
     EXEC=`cat /proc/net/decnet | sed -n '2s/ *\([0-9]\.[0-9]\).*[0-9]\.[0-9]/\1/p'`
101
 
     if [ -z "$EXEC" -o "$EXEC" = "0.0" ]
102
 
     then
103
 
       $startnet
104
 
       if [ $? != 0 ]
105
 
       then
106
 
         echo error starting socket layer.
107
 
         exit 1
108
 
       fi
109
 
     fi
 
68
     NODE=`grep executor /etc/decnet.conf| awk '{print $2}'`
 
69
     echo "$NODE" > /proc/sys/net/decnet/node_address
 
70
     CCT=`grep executor /etc/decnet.conf | awk '{print $6}'`
 
71
     echo "$CCT" > /proc/sys/net/decnet/default_device
 
72
     $prefix/sbin/setether $NODE $CCT $extra_interfaces 
110
73
 
111
74
     for i in $daemons
112
75
     do