mirror of
https://git.FreeBSD.org/ports.git
synced 2024-12-12 03:00:28 +00:00
df6d51ba28
- bump PORTREVISION PR: ports/102013 Submitted by: pirzyk (maintianer)
57 lines
1.5 KiB
Bash
57 lines
1.5 KiB
Bash
#!/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
|