summaryrefslogtreecommitdiff
path: root/mail/yatsvrs/INSTALL
blob: 300d8acf12d41c41d686202d054c0e9eeca1a4c4 (plain)
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
#!/bin/sh
# $Id: INSTALL,v 1.2 2001/12/19 04:11:08 taca Exp $

PKGNAME=$1
STAGE=$2

AWK="@AWK@"
CHMOD="@CHMOD@"
MKDIR="@MKDIR@"
INSTALL_DATA="@YATSVR_INSTALL_DATA@"

YAT_CONF_DIR="@PKG_SYSCONFDIR@"
YAT_EXAMPLES_DIR="@EXAMPLESDIR@"
DEFAULT_ADMIN="@DEFAULT_ADMIN@"
EXAMPLES="@EXAMPLES@"
MIN="@YATSVR_MINGID@"
MAX="@YATSVR_MAXGID@"

case ${STAGE} in
PRE-INSTALL)
	;;
POST-INSTALL)

	if [ ! -d ${YAT_CONF_DIR} ]; then
		${MKDIR} -p ${YAT_CONF_DIR}
	fi
	for f in ${EXAMPLES}; do
		if [ ! -f ${YAT_CONF_DIR}/$f ]; then
			${INSTALL_DATA} ${YAT_EXAMPLES_DIR}/$f.example \
				${YAT_CONF_DIR}/$f
		fi
	done
	if [ ! -f ${YAT_CONF_DIR}/.admin ]; then
		echo ${DEFAULT_ADMIN} > ${YAT_CONF_DIR}/.admin
		${CHMOD} 0600 ${YAT_CONF_DIR}/.admin
	fi
	# hack for restrict groups
	${AWK} -F: '$1 !~ /^no/ { if ($3 < '$MIN' || $3 > '$MAX') print $1}' \
		/etc/group > ${YAT_CONF_DIR}/.hidden-group
	${CHMOD} 0600 ${YAT_CONF_DIR}/.hidden-group
	;;
*)
	echo "Unexpected argument: ${STAGE}"
	exit 1
	;;
esac
exit 0