File: dnet-common.postinst

package info (click to toggle)
dnprogs 2.18-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,896 kB
  • ctags: 3,051
  • sloc: ansic: 18,586; cpp: 9,436; makefile: 669; sh: 502; awk: 13
file content (45 lines) | stat: -rwxr-xr-x 773 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#

set -e

if [ "$1" != "configure" ]
then
  exit 0
fi

. /usr/share/debconf/confmodule

# Get the node name and address
db_get dnet-common/nodename
name=$RET
db_get dnet-common/nodeaddr
addr=$RET

db_stop

# Update /etc/decnet.conf

if [ ! -f /etc/decnet.conf ] 
then
  cp /usr/share/doc/dnet-common/decnet.conf.sample /etc/decnet.conf
  chmod 0644 /etc/decnet.conf
fi

TMPFILE="`tempfile`"

cat /etc/decnet.conf | awk -v NAME=$name -vADDR=$addr '
{ if ($1 == "executor") { printf("executor\t%s\t\tname\t\t%s\tline\teth0\n", ADDR, NAME) ;} else { print $0; } }' > $TMPFILE

cp /etc/decnet.conf /etc/decnet.conf.old
cp $TMPFILE /etc/decnet.conf
if [ $? -ne 0 ]
then
  cp /etc/decnet.conf.old /etc/decnet.conf
fi

rm -f $TMPFILE

/sbin/update-modules

#DEBHELPER#