blob: 38e097083e6d12dd3683b6fab2566f668d8a7612 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#!/bin/sh
PKG_PREFIX=${PKG_PREFIX:-/usr/local}
if [ $# -ne 2 ]; then
echo "usage: $0 distname { PRE-INSTALL | POST-INSTALL }" >&2
exit 1
fi
case $2 in
POST-INSTALL)
grep csnet-ns /etc/services > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "adding csnet-ns to /etc/services..."
cp /etc/services /etc/services.pre.$1
echo "csnet-ns 105/tcp ns # PH" >> /etc/services
fi
if [ ! -d "${PKG_PREFIX}/etc" ]; then
echo "creating directory ${PKG_PREFIX}/etc...";
mkdir -p "${PKG_PREFIX}/etc";
fi
PH_SERVER=`hostname | awk -F. '(NF > 1) { printf "ns.%s.%s\n", $(NF - 1), $NF; }'`;
if [ -z "${PH_SERVER}" ]; then
if [ -x /usr/sbin/nslookup ]; then
NSLOOKUP=/usr/sbin/nslookup;
elif [ -x /usr/bin/nslookup ]; then
NSLOOKUP=/usr/bin/nslookup;
fi
if [ -n "${NSLOOKUP}" ]; then
PH_SERVER=`hostname | xargs ${NSLOOKUP} | awk '/^Name:/ { print $2; exit; }' | awk -F. '{ printf("ns.%s.%s\n", $(NF - 1), $NF); }'`;
fi
fi
if [ -z "${PH_SERVER}" ]; then
PH_SERVER="ns.some-domain.example.org";
fi
echo "${PH_SERVER}" > ${PKG_PREFIX}/etc/ph_server.sample;
if [ ! -f "${PKG_PREFIX}/etc/ph_server" ]; then
echo "creating default ${PKG_PREFIX}/etc/ph_server file...";
cp ${PKG_PREFIX}/etc/ph_server.sample ${PKG_PREFIX}/etc/ph_server;
fi
if [ ! -f "${PKG_PREFIX}/etc/nphrc" ]; then
echo "installing default ${PKG_PREFIX}/etc/nphrc file...";
cp ${PKG_PREFIX}/etc/nphrc.sample ${PKG_PREFIX}/etc/nphrc;
fi
;;
esac
exit 0
|