aboutsummaryrefslogtreecommitdiffstats
path: root/misc/linux-opengroupware/pkg-install
blob: cef0b690d3915f2b0c7677b71bb95f97c907d4b3 (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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/sh
#$Id: pkg-install,v 1.2 2003/09/13 14:59:44 frank Exp $
# Frank Reppin
# $FreeBSD$

case $2 in
POST-INSTALL)

    OGO_USER='ogo'
    OGO_GROUP='skyrix'
    OGO_HOME='/compat/linux/opt/opengroupware.org'
    OGO_DST='/compat/linux/opt'
    OGO_DESCR='OpenGroupware'
    OGO_SHELL='/usr/local/bin/bash'

    echo "######################################################################################"
    echo "Creating neccessary user/group"
    if pw group show "${OGO_GROUP}" 2>/dev/null; then
        echo "Found existing group \"${OGO_GROUP}\", nothing to be done for me here."
    else
        if pw group add ${OGO_GROUP}; then
            echo "Successfully added group: \"${OGO_GROUP}\"."
            else
            echo "pw group add ${OGO_GROUP} failed :/."
            exit 1
        fi
    fi

    if pw user show "${OGO_USER}" 2>/dev/null; then
        echo "Found existing user \"${OGO_USER}\", nothing to be done for me here."
    else
        if pw user add ${OGO_USER} -g ${OGO_GROUP} -c ${OGO_DESCR} -d ${OGO_HOME} -s ${OGO_SHELL}; then
            echo "Successfully added user: \"${OGO_USER}\"."
            else
            echo "pw user add ${OGO_USER} failed :/."
            exit 1
        fi
    fi
    echo "######################################################################################"
    ;;

WRITE-DEFAULTS-FIRSTTIME)

    OGO='ogo'
    OGO_GROUP='skyrix'
    SU='/usr/bin/su'
    ME=`hostname`
    DW='Defaults write'
    DR='Defaults read'

    #just to be sure I am already there... weird issue if not
    mkdir -p /compat/linux/opt/opengroupware.org/.libFoundation/Defaults
    chown -Rh ${OGO}:${OGO_GROUP} /compat/linux/opt/opengroupware.org/.libFoundation
    if [ ! -e /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/NSGlobalDomain.plist ] 2>/dev/null; then
        echo "There seems to be no previous OGo installation..."
        echo "going to write \`Defaults\` to .libFoundation/Defaults/NSGlobalDomain.plist"
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain skyrix_id ${ME}" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain LSAdaptor PostgreSQL72" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain LSModelName OpenGroupware.org_PostgreSQL" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain LSMaxSearchCount 500" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain LSConnectionDictionary '{hostName=localhost; userName=ogo; password=\"\"; port=5432; databaseName=ogo}'" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain LSAttachmentPath \"/compat/linux/opt/opengroupware.org/documents\"" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain LSNewsImagesPath \"/compat/linux/opt/opengroupware.org/news\"" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain LSNewsImagesUrl \"/ArticleImages\"" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain NGBundlePath \"/compat/linux/opt/opengroupware.org/Library/OpenGroupware.org\"" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain XMLReader libxmlSAXDriver" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain WOPort localhost:19999" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain TimeZoneName GMT" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain Languages '{English}'" >/dev/null 2>&1
        ${SU} -l ${OGO} -c "${DW} NSGlobalDomain LSTimeZones '(GMT, MET, PST, CET, EET, EST, HST, MST, NZ, \"GMT+0100\", \"GMT+0200\", \"GMT+0300\", \"GMT+0400\", \"GMT+0500\", \"GMT+0600\", \"GMT+0700\", \"GMT+0800\", \"GMT+0900\", \"GMT+1000\", \"GMT+1100\", \"GMT+1200\", \"GMT-0100\", \"GMT-0200\", \"GMT-0300\", \"GMT-0400\", \"GMT-0500\", \"GMT-0600\", \"GMT-0700\", \"GMT-0800\", \"GMT-0900\", \"GMT-1000\", \"GMT-1100\", \"GMT-1200\")'" >/dev/null 2>&1

        echo "done."
    else
        echo "I think you've already installed OGo before..."
        echo "Thus i am kind and don't mess your settings :)"
    fi
    ;;

COPY-TEMPLATES)

    INSTALL='/usr/bin/install'
    OGO_USER='ogo'
    OGO_GROUP='skyrix'

    #just to be sure I am already there... weird issue if not
    mkdir -p /compat/linux/opt/opengroupware.org/.libFoundation/Defaults
    if [ ! -e /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/OpenGroupware.plist ] 2>/dev/null; then
        echo "OpenGroupware.plist not found..."
        echo "thus I am using the one coming with the port."
        ${INSTALL} -m 640 -o ${OGO_USER} -g ${OGO_GROUP}  files/OpenGroupware.plist.tmpl /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/OpenGroupware.plist >/dev/null 2>&1
    else
        echo "OpenGroupware.plist is already in place!"
    fi

    if [ ! -e /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/ZideStore.plist ] 2>/dev/null; then
        echo "ZideStore.plist not found..."
        echo "thus I am using the one coming with the port."
        ${INSTALL} -m 640 -o ${OGO_USER} -g ${OGO_GROUP} files/ZideStore.plist.tmpl /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/ZideStore.plist >/dev/null 2>&1
    else
        echo "ZideStore.plist is already in place!"
    fi

    if [ ! -e /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/xmlrpcd.plist ] 2>/dev/null; then
        echo "xmlrpcd.plist not found..."
        echo "thus I am using the one coming with the port."
        ${INSTALL} -m 640 -o ${OGO_USER} -g ${OGO_GROUP} files/xmlrpcd.plist.tmpl /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/xmlrpcd.plist >/dev/null 2>&1
    else
        echo "xmlrpcd.plist is already in place!"
    fi

    if [ ! -e /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/skyaptnotify.plist ] 2>/dev/null; then
        echo "skyaptnotify.plist not found..."
        echo "thus I am using the one coming with the port."
        ${INSTALL} -m 640 -o ${OGO_USER} -g ${OGO_GROUP} files/skyaptnotify.plist.tmpl /compat/linux/opt/opengroupware.org/.libFoundation/Defaults/skyaptnotify.plist >/dev/null 2>&1
    else
        echo "skyaptnotify.plist is already in place!"
    fi

    ;;
esac