summaryrefslogtreecommitdiffstats
path: root/packaging/HPUX/configure.swat
blob: 0e69fc03fe45123cd27709a431dcb76d07da77f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# Configure script for Samba.swat

UPDATE=0

KillProcess()
{
  proc=$1
  sig=$2

  # Determine PID of process(es) to stop and kill it.  This routine
  # is designed to work with bourne shell, ksh and posix shell.

  Command=`basename $proc | cut -c1-8`     # Solaris ps limited to 8 chars.

  pid=`ps -e | awk "\\$NF~/$Command/ {print \\$1}"`

  if [ "X$pid" != "X" ]; then
    kill -$sig $pid
  fi
}

UpdateServices()
{
  if grep -q '^swat' /etc/services
  then
    return
  fi

  echo "swat      901/tcp" >>/etc/services
  cat <<__EOF__
NOTE:    The following entry had been added to /etc/services:
             swat        901/tcp
         Should you want to move SWAT to another port, modify the entry
         accordingly and restart inetd daemon with -HUP signal.
__EOF__
  UPDATE=1
}

UpdateInetd()
{
  if grep -q '^swat' /etc/inetd.conf
  then
    return
  fi

  echo "swat    stream tcp   nowait.400 root /usr/local/samba/bin/swat swat" >>/etc/inetd.conf


  UPDATE=1
}

UpdateServices
UpdateInetd

if [ "$UPDATE" -eq 1 ]
then
  KillProcess inetd HUP
fi

exit 0