aboutsummaryrefslogtreecommitdiffstats
path: root/mail/alpine/pkg-install
blob: c7e0a18d5aed528e78db2799af1834eb87a6163b (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
#!/bin/sh

[ "$2" = 'POST-INSTALL' ] || exit 0

PATH=/bin:/usr/bin
export PATH

TDIR=`mktemp -d ${TMPDIR:-/tmp}/alpine-conf.XXXXXXXX`

if [ -s "${PKG_PREFIX}/etc/alpine.conf" ]; then
    mv ${PKG_PREFIX}/etc/alpine.conf ${TDIR}/alpine.conf.installed
fi

${PKG_PREFIX}/bin/alpine -conf > ${TDIR}/alpine.conf.sample
install -o root -g wheel -m 444 ${TDIR}/alpine.conf.sample ${PKG_PREFIX}/etc/alpine.conf.sample

[ -s "${TDIR}/alpine.conf.installed" ] && mv ${TDIR}/alpine.conf.installed ${PKG_PREFIX}/etc/alpine.conf

${PKG_PREFIX}/bin/alpine -conf > ${TDIR}/alpine.conf

if [ -e "${PKG_PREFIX}/etc/alpine.conf" ]; then
    if ! cmp -s ${TDIR}/alpine.conf ${PKG_PREFIX}/etc/alpine.conf; then
        unlink ${PKG_PREFIX}/etc/alpine.conf
        install -o root -g wheel -m 444 ${TDIR}/alpine.conf ${PKG_PREFIX}/etc/alpine.conf
    fi
else
    cp -p ${PKG_PREFIX}/etc/alpine.conf.sample ${PKG_PREFIX}/etc/alpine.conf
fi

rm -rf $TDIR

exit 0