Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 163 lines (148 sloc) 4.76 kb
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
1 #! /bin/sh -e
2 #
462c8b4 @racke use virtual host instead of system hostname as server name for the
racke authored
3 # Copyright 2001,2004,2005,2006,2008,2009 by Stefan Hornburg (Racke) <racke@linuxia.de>
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public
16 # License along with this program; if not, write to the Free
07f71a7 @pajamian New Free Software Foundation Address in headers of various files
pajamian authored
17 # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
18 # MA 02110-1301 USA.
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
19
20 # Source debconf library
21 . /usr/share/debconf/confmodule
0a55170 @racke Added missing dbconfig-common hooks and set defaults for database name a...
racke authored
22
23 # Call dbconfig-common hook
24 . /usr/share/dbconfig-common/dpkg/postinst
0e570c7 @racke introduced dbconfig-common for configuring database (work in progress)
racke authored
25 dbc_go interchange-cat-standard $@
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
26
27 GOAHEAD=false
28
29 # Get interchange user and group
30 db_get interchange/user
31 USER=$RET
32 db_get interchange/group
33 GROUP=$RET
34
35 # Whether to do the actual installation of the demo catalog
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
36 db_get interchange-cat-standard/install
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
37
38 if [ "$RET" = "true" ]; then
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
39 CATALOG=standard
a0b37e7 @racke recommit of changes put into the old branch
racke authored
40 if [ -d /var/lib/interchange/catalogs/$CATALOG ]; then
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
41 db_get interchange-cat-standard/replace
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
42 if [ "$RET" = "always" ]; then
43 GOAHEAD=true
44 elif [ "$RET" = "ask" ]; then
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
45 db_get interchange-cat-standard/confirm
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
46 GOAHEAD=$RET
47 fi
a0b37e7 @racke recommit of changes put into the old branch
racke authored
48 if [ "$GOAHEAD" = "true" ]; then
49 rm -rf /var/lib/interchange/catalogs/$CATALOG
50 fi
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
51 else
52 GOAHEAD=true
53 fi
54 fi
55
56 if [ "$GOAHEAD" = "true" ]; then
57 db_get interchange/docroot
a0b37e7 @racke recommit of changes put into the old branch
racke authored
58
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
59 # document root for static HTML
60 BASEDIR=/var/lib/interchange/catalogs
a0b37e7 @racke recommit of changes put into the old branch
racke authored
61 CGIBASE=/cgi-bin/ic
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
62 DOCROOT="$RET"
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
63 CATALOG=standard
a0b37e7 @racke recommit of changes put into the old branch
racke authored
64
65 # replace document root
0f5235b @racke safeguard added
racke authored
66 if [ "$DOCROOT" -a -d "$DOCROOT" ]; then
67 rm -rf $DOCROOT/$CATALOG
68 fi
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
69 mkdir -p $DOCROOT/$CATALOG/images
a0b37e7 @racke recommit of changes put into the old branch
racke authored
70 chown -R $USER.$GROUP $DOCROOT/$CATALOG
71
72 # replace catalog directory
73 mkdir /var/lib/interchange/catalogs/$CATALOG
74 chown $USER.$GROUP /var/lib/interchange/catalogs/$CATALOG
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
75 db_get interchange-cat-standard/username
e339b15 @racke merged changes 2.7.2.1 vs 2.7.2.2
racke authored
76 UI_SUPERUSER=$RET
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
77 db_get interchange-cat-standard/password
e339b15 @racke merged changes 2.7.2.1 vs 2.7.2.2
racke authored
78 UI_PASSWORD=$RET
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
79 db_get interchange-cat-standard/locales
334d888 @racke introduced selection of locales
racke authored
80 LOCALES=`echo "$RET" | sed -e 's/, /,/'`
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
81 db_get interchange-cat-standard/defaultlocale
d75351f @racke new debconf question for defaultlocale
racke authored
82 DEFAULTLOCALE=$RET
4401341 @racke allow selection of RDBMS for demo catalog
racke authored
83 # determine database parameters
84 MYSQL=0
85 PGSQL=0
36d0f71 @racke SQLite support added for standard demo
racke authored
86 SQLITE=0
4401341 @racke allow selection of RDBMS for demo catalog
racke authored
87 SQLDSN=
88 db_get interchange-cat-standard/dbtype
0e570c7 @racke introduced dbconfig-common for configuring database (work in progress)
racke authored
89 if [ "$dbc_dbtype" = "mysql" ]; then
4401341 @racke allow selection of RDBMS for demo catalog
racke authored
90 MYSQL=1
0e570c7 @racke introduced dbconfig-common for configuring database (work in progress)
racke authored
91 SQLDSN="dbi:mysql:$dbc_dbname"
93e3b5f @racke fixed typo
racke authored
92 elif [ "$dbc_dbtype" = "pgsql" ]; then
4401341 @racke allow selection of RDBMS for demo catalog
racke authored
93 PGSQL=1
0e570c7 @racke introduced dbconfig-common for configuring database (work in progress)
racke authored
94 SQLDSN="dbi:Pg:dbname=$dbc_dbname"
36d0f71 @racke SQLite support added for standard demo
racke authored
95 elif [ "$dbc_dbtype" = "sqlite" ]; then
96 SQLITE=1
97 SQLDSN="dbi:SQLite:dbname=$dbc_dbname"
4401341 @racke allow selection of RDBMS for demo catalog
racke authored
98 fi
36d0f71 @racke SQLite support added for standard demo
racke authored
99
462c8b4 @racke use virtual host instead of system hostname as server name for the
racke authored
100 # with full URL enabled we use virtual host provided by the user
101 db_get interchange/full_url
102 if [ "$RET" = "true" ]; then
103 db_get interchange-cat-standard/vhost
104 SERVERNAME="$RET"
105 else
106 SERVERNAME=`hostname --fqdn 2>/dev/null || echo localhost`
107 fi
108
36d0f71 @racke SQLite support added for standard demo
racke authored
109 MVC_ENABLESECURE=1 MVC_UISECURE=1 MVC_SUPERUSER="$UI_SUPERUSER" MVC_CRYPTPW="$UI_PASSWORD" MVC_LOCALES="$LOCALES" MVC_DEFAULTLOCALE="$DEFAULTLOCALE" MVC_SKIP_ADD_GLOBAL_USERTAG=1 MVC_SQLITE=1 MVC_MYSQL=$MYSQL MVC_PGSQL=$PGSQL /usr/bin/makecat \
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
110 -F \
a0b37e7 @racke recommit of changes put into the old branch
racke authored
111 -l /var/log/interchange/makecat.log \
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
112 --demotype=$CATALOG \
113 --catalogname=$CATALOG \
114 --basedir=$BASEDIR \
115 --catroot=$BASEDIR/$CATALOG \
116 --documentroot=$DOCROOT \
117 --samplehtml=$DOCROOT/$CATALOG \
64d3b35 @racke merged changes 2.7 vs 2.7.2.1
racke authored
118 --sampleurl=http://$SERVERNAME/shops/$CATALOG \
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
119 --imagedir=$DOCROOT/$CATALOG/images \
120 --imageurl=/shops/$CATALOG/images \
b029125 @racke use hostname --fqdn for the server name
racke authored
121 --servername=$SERVERNAME \
a0b37e7 @racke recommit of changes put into the old branch
racke authored
122 --sharedir=NONE \
2058393 @racke fix URL for shared images
racke authored
123 --shareurl='' \
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
124 --cgidir=/usr/lib/cgi-bin/ic \
125 --cgibase=$CGIBASE \
a0b37e7 @racke recommit of changes put into the old branch
racke authored
126 --cgiurl=$CGIBASE/$CATALOG \
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
127 --interchangeuser=$USER \
128 --interchangegroup=$GROUP \
129 --permtype=user \
130 --serverconf=/etc/apache/httpd.conf \
131 --vendroot=/usr/lib/interchange \
132 --linkmode=UNIX \
133 --catuser=$USER \
134 --mailorderto=$USER \
0e570c7 @racke introduced dbconfig-common for configuring database (work in progress)
racke authored
135 --nocfg \
136 MYSQLCREATE=0 \
137 SQLDSN="$SQLDSN" \
138 SQLUSER="$dbc_dbuser" \
139 SQLPASS="$dbc_dbpass"
64d3b35 @racke merged changes 2.7 vs 2.7.2.1
racke authored
140 fi
af5f13c @racke call interchangeconfig if foundation catalog is created
racke authored
141
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
142 db_get interchange-cat-standard/install
64d3b35 @racke merged changes 2.7 vs 2.7.2.1
racke authored
143 if [ "$RET" = "true" ]; then
c5c0466 @racke consider FullURL setting for demo catalog
racke authored
144 db_get interchange/full_url
145 if [ "$RET" = "true" ]; then
146 db_get interchange-cat-standard/vhost
147 URLS="$RET/cgi-bin/ic/standard $RET:443/cgi-bin/ic/standard"
148 else
149 URLS="/cgi-bin/ic/standard"
150 fi
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
151 cat <<EOF >/var/lib/interchange/catalog.d/interchange-cat-standard.cfg
152 include usertag/standard/*
e98a9ee @racke require TestPayment payment module to allow orders from demo catalog
racke authored
153 require module Vend::Payment::TestPayment
c5c0466 @racke consider FullURL setting for demo catalog
racke authored
154 Catalog standard /var/lib/interchange/catalogs/standard $URLS
059e10b @racke initial effort to replacing foundation with standard catalog in Debian p...
racke authored
155 EOF
82268cf @racke avoid installation error by checking installation state before
racke authored
156 if [ ! -f /var/run/interchange-install ]; then
157 # add catalog to running server
62dd067 @racke eliminated commands with absolute paths in maintainer scripts
racke authored
158 echo "Catalog standard /var/lib/interchange/catalogs/standard $URLS" | interchange --add standard
82268cf @racke avoid installation error by checking installation state before
racke authored
159 fi
b31a690 @jonjensen Move DEV_4_7_0 development branch to repository trunk.
jonjensen authored
160 fi
161
162 #DEBHELPER#
Something went wrong with that request. Please try again.