summaryrefslogtreecommitdiff
path: root/packaging/Caldera/OpenServer/pkg/cntl/ccs
blob: 0cb22490e474803241e14e19293ebe46581e7cd7 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh
#
# Postinstallscript written by Ron Record (rr@sco.com) 
# 

scriptname="$0"
step="$1"
keywords="$2"
pkglist="$3"

# Source in the standard functions library, ccsSetup.sh
. ccsSetup.sh

ccs_return_value=0

SPOOL=/var/spool/samba
SVCS=/etc/services
INET=/etc/inetd.conf
LMHOST=/etc/lmhosts
PREFIX=/usr/local/samba

#
# Create /var/spool/samba, create an initial /etc/lmhosts, build the
# codepages and setup swat to be run out of inetd on port 901
#
PostExport()
{
    [ -d $SPOOL ] || {
         mkdir -p $SPOOL
         chmod 1777 $SPOOL
    }
    if [ -f $LMHOST ]
    then
        grep localhost $LMHOST > /dev/null || {
            echo 127.0.0.1 localhost >> $LMHOST
        }
    else
        echo 127.0.0.1 localhost > $LMHOST
    fi

    cd ${PREFIX}/lib/codepages
    for i in 437 737 775 850 852 861 866 932 936 949 950 1251
    do
        ${PREFIX}/bin/make_smbcodepage c $i \
            ${PREFIX}/lib/codepages/src/codepage_def.$i \
            ${PREFIX}/lib/codepages/codepage.$i
    done
    for i in 437 737 850 852 861 866 932 936 949 950 \
         ISO8859-1 ISO8859-2 ISO8859-5 ISO8859-7 KOI8-R
    do
        ${PREFIX}/bin/make_unicodemap $i \
            ${PREFIX}/lib/codepages/src/CP$i.TXT \
            ${PREFIX}/lib/codepages/unicode_map.$i
    done
    
    grep swat $SVCS > /dev/null || {
         echo "swat    901/tcp    # Samba Web Administration Tool " >> $SVCS
    }
    
    grep swat $INET > /dev/null || {
     echo "swat stream tcp nowait root /usr/local/samba/bin/swat swat " >> $INET
    }
    
    kill -1 `ps -e | grep inetd | awk ' { print $1 } '`
}

DisableStop()
{
    /etc/init.d/samba disable > /dev/null 2>&1
    /etc/init.d/samba stop > /dev/null 2>&1
}

#
# Remove /var/spool/samba and delete inetd entries for swat
#
PostUnexport()
{
    [ -d $SPOOL ] && {
         rm -rf $SPOOL
    }

    grep swat $SVCS > /dev/null && {
         B=`basename $SVCS`
         T=$B$$
         grep -v swat $SVCS > /tmp/$T
         cp /tmp/$T $SVCS
         rm -f /tmp/$T
    }
    
    grep swat $INET > /dev/null || {
         B=`basename $INET`
         T=$B$$
         grep -v swat $INET > /tmp/$T
         cp /tmp/$T $INET
         rm -f /tmp/$T
    }
    
    kill -1 `ps -e | grep inetd | awk ' { print $1 } '`
}
    
case "$step" in
        POST_EXPORT) PostExport ;;
        PRE_UNEXPORT) DisableStop ;;
        POST_UNEXPORT) PostUnexport ;;
esac

exit $ccs_return_value