summaryrefslogtreecommitdiffstats
path: root/network/xinetd/doinst.sh
blob: 2a82b398238f0c70579eedfc3d2cca2d8e1859c3 (plain) (blame)
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
config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    rm $NEW
  fi
}

preserve_perms() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  if [ -e $OLD ]; then
    cp -a $OLD ${NEW}.incoming
    cat $NEW > ${NEW}.incoming
    mv ${NEW}.incoming $NEW
  fi
  config $NEW
}

config etc/xinetd.conf.new
config etc/xinetd.d/chargen.new
config etc/xinetd.d/chargen-udp.new
config etc/xinetd.d/daytime.new
config etc/xinetd.d/daytime-udp.new
config etc/xinetd.d/discard.new
config etc/xinetd.d/discard-udp.new
config etc/xinetd.d/echo.new
config etc/xinetd.d/echo-udp.new
config etc/xinetd.d/servers.new
config etc/xinetd.d/services.new
config etc/xinetd.d/time.new
config etc/xinetd.d/time-udp.new

preserve_perms etc/rc.d/rc.xinetd.new