aboutsummaryrefslogtreecommitdiffstats
path: root/www/apache13-fp/pkg-install
blob: d2b43b878d2016586b74f2e8ab0ef6a10e80e2c1 (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
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
#!/bin/sh
#
#   $FreeBSD$
#
# Created by: hetzels@westbend.net

PKG_BATCH=${BATCH:=NO}

PKG_PREFIX=${PKG_PREFIX}
AP_SHARE=${PKG_PREFIX}/share/doc/apache
HOST_NAME=`/bin/hostname`
AP_DATA=${PKG_PREFIX}/www/data
FPINSTALL=${PKG_PREFIX}/frontpage/version4.0/fp_install.sh
CHANGESERVER=${PKG_PREFIX}/frontpage/version4.0/change_server.sh
FPDOCDIR=${AP_SHARE}/manual/mod/mod_frontpage
IMAGES_VTI=${PKG_PREFIX}/www/data/images/_vti_cnf
HTTPD_CONF=${PKG_PREFIX}/etc/apache/httpd.conf

create_apache_lang_doc ()
{
    if [ ! -d ${AP_DATA} ]; then
    /bin/mkdir -p ${AP_DATA}
    fi

    for lang in ca cz de dk ee en es fr it ja.jis lu nl po.iso-pl pt pt-br se
    {
    /bin/cat ${AP_SHARE}/index.html.${lang}-dist | \
        /usr/bin/sed -e 's;@@HOSTNAME@@;'${HOST_NAME}';' \
        > ${AP_SHARE}/index.html.${lang}
    if [ ! -f ${AP_DATA}/index.html ] ; then
        if [ ! -f ${AP_DATA}/index.html.${lang} ]; then
        /bin/cp -rp ${AP_SHARE}/index.html.${lang} \
            ${AP_DATA}/index.html.${lang}
        fi
    fi
    }
}

fix_frontpage_scripts ()
{
    /bin/cat ${FPINSTALL}-dist | \
    /usr/bin/sed    -e 's;PREFIX;'${PKG_PREFIX}';' \
            -e 's;MOD_FPDOCDIR;'${FPDOCDIR}';' \
    > ${FPINSTALL}
    /bin/cat ${CHANGESERVER}-dist | \
    /usr/bin/sed    -e 's;PREFIX;'${PKG_PREFIX}';' \
    > ${CHANGESERVER}
    /bin/chmod 555 ${CHANGESERVER} ${FPINSTALL}
    /usr/sbin/chown bin ${CHANGESERVER} ${FPINSTALL}
}

fix_httpd_conf ()
{
    if [ ! -f ${HTTPD_CONF} ] ; then
    /bin/cat ${HTTPD_CONF}.default | \
        /usr/bin/sed -e 's;@@HOSTNAME@@;'${HOST_NAME}';' \
        > ${HTTPD_CONF}
    fi
}
#Add the appropriate comment to the images/_vti_cnf file.
comment_files ()
{
    if [ -d ${IMAGES_VTI} ]; then \
    if [ ! "`grep description ${IMAGES_VTI}/apache_pb.gif`" ] ; then \
        /bin/echo "vti_description:SW|Apache Webserver" >> ${IMAGES_VTI}/apache_pb.gif ;\
    fi
    if [ ! "`grep description ${IMAGES_VTI}/fplogo.gif`" ] ; then \
        /bin/echo "vti_description:SW|Created with Microsoft FrontPage 2000" >> ${IMAGES_VTI}/fplogo.gif ; \
    fi
    if [ ! "`grep description ${IMAGES_VTI}/powerlogo.gif`" ] ; then \
        /bin/echo "vti_description:SW|Powered by FreeBSD" >> ${IMAGES_VTI}/powerlogo.gif ; \
    fi
    fi
}

case $2 in
    PRE-INSTALL)
    ;;
    POST-INSTALL)
    # If we are not in batch mode then run the FP install script.
        if [ "${PKG_BATCH}" = "NO" ]; then
        create_apache_lang_doc
        fix_frontpage_scripts
        fix_httpd_conf
        ${FPINSTALL}
        comment_files
    fi
    ;;

esac