File: dnet-common.postinst

package info (click to toggle)
dnprogs 2.52
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 3,644 kB
  • ctags: 4,021
  • sloc: ansic: 26,737; cpp: 10,666; makefile: 832; sh: 537; awk: 13
file content (43 lines) | stat: -rwxr-xr-x 751 bytes parent folder | download | duplicates (2)
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
#!/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

#DEBHELPER#