1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00
freebsd-ports/mail/alpine/pkg-install
Doug Barton 2d3c3b823e There is no need to include PKGINSTALL in the pico package
Give the alpine/pkg-install script triple protection against
being run inappropriately.
2010-12-08 06:46:46 +00:00

40 lines
1005 B
Bash

#!/bin/sh
[ "$2" = 'POST-INSTALL' ] || exit 0
case "$1" in
alpine*) ;;
*) exit 0 ;;
esac
[ -x "${PKG_PREFIX}/bin/alpine" ] || exit 1
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 [ -s "${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