aboutsummaryrefslogtreecommitdiff
path: root/news/inn/pkg-install
blob: f3345e3dccac0c6d0907881a8152413fe12b2c3a (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
#!/bin/sh

PKGNAME=$1
[ ! -n PKG_PREFIX ] && exit 1
PKG_PREFIX=${PKG_PREFIX:-/usr/local}

case $2 in
    PRE-INSTALL)
	;;
    CHECK-CONF)
	ETC_DIR=${3}
	echo "Checking for configuration files"
	for f in $(find ${ETC_DIR} -name "*.dist" -type f)
		do
			REALFILE=${f%%.dist}
			echo -n "Checking if ${REALFILE} exists:   "
			if [ -e ${REALFILE} ] 
				then
					echo "[YES]"
				else
					echo "[NO]"
					echo "     Installing ${f} to ${REALFILE}"
					cp -p ${f} ${REALFILE}
			fi
		done
	;;
    POST-INSTALL)
	NEWSBASE=${PKG_PREFIX}/news
        install -d -o news -g news -m 755 \
	    ${NEWSBASE}/run \
	    ${NEWSBASE}/spool \
	    ${NEWSBASE}/spool/archive \
	    ${NEWSBASE}/spool/articles \
	    ${NEWSBASE}/spool/incoming \
	    ${NEWSBASE}/spool/incoming/bad \
	    ${NEWSBASE}/spool/innfeed \
	    ${NEWSBASE}/spool/outgoing \
	    ${NEWSBASE}/spool/overview \
	    ${NEWSBASE}/spool/tmp
	;;
    *)
	echo "Unexpected Argument $2!!!"
	exit 1
	;;
esac
exit 0