aboutsummaryrefslogtreecommitdiffstats
path: root/net/samba32/files/pkg-install.in
blob: 4272647e0b45f51114c87a65918b422e34b2a318 (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
#! /bin/sh
#
PATH=/bin:/usr/sbin:/usr/bin:/usr/sbin

EXAMPLESDIR="%%EXAMPLESDIR%%"
SAMBA_CONFIG="%%SAMBA_CONFIG%%"
SAMBA_CONFDIR="%%SAMBA_CONFDIR%%"
SAMBA_SPOOL="%%SAMBA_SPOOL%%"
SAMBA_LOGDIR="%%SAMBA_LOGDIR%%"
SAMBA_LOCKDIR="%%SAMBA_LOCKDIR%%"
SAMBA_PRIVATEDIR="%%SAMBA_PRIVATEDIR%%"
SAMBA_OWNER=root
SAMBA_GROUP=wheel
INSTALL_DATA="install -c -m 0444"
MKDIR="mkdir -p"
CHMOD="chmod"
CHOWN="chown"

post-install() {
    ${MKDIR} ${SAMBA_SPOOL} && ${CHMOD} 1777 ${SAMBA_SPOOL}
    ${MKDIR} ${SAMBA_LOGDIR} && ${CHMOD} 0755 ${SAMBA_LOGDIR}
    ${MKDIR} ${SAMBA_LOCKDIR} && ${CHMOD} 0755 ${SAMBA_LOCKDIR}
    ${MKDIR} ${SAMBA_PRIVATEDIR} && ${CHMOD} 0700 ${SAMBA_PRIVATEDIR}
    if [ $(id -u) -eq 0 ]; then
        INSTALL_DATA="${INSTALL_DATA} -o ${SAMBA_OWNER} -g ${SAMBA_GROUP}"
        ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_SPOOL}
        ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_LOGDIR}
        ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_LOCKDIR}
        ${CHOWN} ${SAMBA_OWNER}:${SAMBA_GROUP} ${SAMBA_PRIVATEDIR}
    fi
    ${INSTALL_DATA} ${EXAMPLESDIR}/${SAMBA_CONFIG}.sample ${SAMBA_CONFDIR}
    if [ ! -f ${SAMBA_CONFDIR}/${SAMBA_CONFIG} ]; then
        ${INSTALL_DATA} ${EXAMPLESDIR}/${SAMBA_CONFIG}.sample ${SAMBA_CONFDIR}/${SAMBA_CONFIG}
    fi
}

case $2 in
    POST-INSTALL)
        post-install
        ;;
esac