aboutsummaryrefslogtreecommitdiffstats
path: root/net/silc-client/pkg-install
blob: 554154b67b2e6540f789cf278edc1c256019160d (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
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/sh
# $FreeBSD$

# based on original from op port, written by Cyrille Lefevre
# <clefevre@citeweb.net>

[ $# != 2 ] && exit 1
PKGNAME=$1
ACTION=$2

CONF_DIR=${PKG_PREFIX}/etc/silc

CONF_FILE=silc.conf
CONF_OWN=root
CONF_GRP=wheel
CONF_MODE=444

SAMP_SUFX=.sample

INSTALL=install
CMP=cmp
RM=rm
RMDIR=rmdir

INSTALL_DIR="${INSTALL} -d -o root -g wheel -m 755"

case "$ACTION" in

POST-INSTALL)
    if [ -f "${CONF_DIR}/${CONF_FILE}" ]
    then
        echo "$PKGNAME: Will not overwrite existing ${CONF_DIR}/${CONF_FILE} configuration file."
    else
        ${INSTALL} -c -o ${CONF_OWN} -g ${CONF_GRP} -m ${CONF_MODE} \
            ${CONF_DIR}/${CONF_FILE}${SAMP_SUFX} \
            ${CONF_DIR}/${CONF_FILE}
    fi
    ;;

DEINSTALL)
    if ${CMP} -s ${CONF_DIR}/${CONF_FILE}${SAMP_SUFX} \
          ${CONF_DIR}/${CONF_FILE}; then
        ${RM} -f ${CONF_DIR}/${CONF_FILE}
    else
        echo "$PKGNAME: Will not remove existing ${CONF_DIR}/${CONF_FILE} configuration file."
        echo "$PKGNAME: However, if you are permanently removing this port, you should do a 'rm -f ${CONF_DIR}/${CONF_FILE}' to remove the configuration file left."
        echo "$PKGNAME: Also, do not forget to 'rmdir ${CONF_DIR} 2>/dev/null'"
    fi
    ;;

PRE-INSTALL|POST-DEINSTALL)
    ;;

*)
    exit 1
    ;;
esac

exit