Skip to content
This repository
tag: DEB_5_4_2_2
Fetching contributors…

Cannot retrieve contributors at this time

file 144 lines (132 sloc) 4.347 kb
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 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
#! /bin/sh -e
#
# Copyright 2001,2004,2005 by Stefan Hornburg (Racke) <racke@linuxia.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
# MA 02110-1301 USA.

# Source debconf library
. /usr/share/debconf/confmodule

GOAHEAD=false

# Get interchange user and group
db_get interchange/user
USER=$RET
db_get interchange/group
GROUP=$RET

# Whether to do the actual installation of the demo catalog
db_get interchange-cat-standard/install

if [ "$RET" = "true" ]; then
CATALOG=standard
if [ -d /var/lib/interchange/catalogs/$CATALOG ]; then
db_get interchange-cat-standard/replace
if [ "$RET" = "always" ]; then
GOAHEAD=true
elif [ "$RET" = "ask" ]; then
db_get interchange-cat-standard/confirm
GOAHEAD=$RET
fi
if [ "$GOAHEAD" = "true" ]; then
rm -rf /var/lib/interchange/catalogs/$CATALOG
fi
else
GOAHEAD=true
fi
fi

if [ "$GOAHEAD" = "true" ]; then
db_get interchange/docroot

# document root for static HTML
BASEDIR=/var/lib/interchange/catalogs
CGIBASE=/cgi-bin/ic
DOCROOT="$RET"
CATALOG=standard

# replace document root
if [ "$DOCROOT" -a -d "$DOCROOT" ]; then
rm -rf $DOCROOT/$CATALOG
fi
mkdir -p $DOCROOT/$CATALOG/images
chown -R $USER.$GROUP $DOCROOT/$CATALOG

# replace catalog directory
mkdir /var/lib/interchange/catalogs/$CATALOG
chown $USER.$GROUP /var/lib/interchange/catalogs/$CATALOG
db_get interchange-cat-standard/username
UI_SUPERUSER=$RET
db_get interchange-cat-standard/password
UI_PASSWORD=$RET
    db_get interchange-cat-standard/locales
    LOCALES=`echo "$RET" | sed -e 's/, /,/'`
db_get interchange-cat-standard/defaultlocale
DEFAULTLOCALE=$RET
# determine database parameters
MYSQL=0
PGSQL=0
SQLDSN=
db_get interchange-cat-standard/dbname
DBNAME="$RET"
db_get interchange-cat-standard/dbtype
if [ "$RET" = "MySQL" ]; then
MYSQL=1
SQLDSN="dbi:mysql:$DBNAME"
elif [ "$RET" = "PostgreSQL" ]; then
PGSQL=1
SQLDSN="dbi:Pg:dbname=$DBNAME"
fi

SERVERNAME=`hostname --fqdn 2>/dev/null || echo localhost`
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_MYSQL=$MYSQL MVC_PGSQL=$PGSQL MVC_SQLDB="$DBNAME" MVC_SQLDSN="$SQLDSN" MVC_SQLUSER=interchange /usr/bin/makecat \
-F \
-l /var/log/interchange/makecat.log \
--demotype=$CATALOG \
--catalogname=$CATALOG \
--basedir=$BASEDIR \
--catroot=$BASEDIR/$CATALOG \
--documentroot=$DOCROOT \
--samplehtml=$DOCROOT/$CATALOG \
--sampleurl=http://$SERVERNAME/shops/$CATALOG \
--imagedir=$DOCROOT/$CATALOG/images \
--imageurl=/shops/$CATALOG/images \
--servername=$SERVERNAME \
--sharedir=NONE \
--shareurl='' \
--cgidir=/usr/lib/cgi-bin/ic \
--cgibase=$CGIBASE \
--cgiurl=$CGIBASE/$CATALOG \
--interchangeuser=$USER \
--interchangegroup=$GROUP \
--permtype=user \
--serverconf=/etc/apache/httpd.conf \
--vendroot=/usr/lib/interchange \
--linkmode=UNIX \
--catuser=$USER \
--mailorderto=$USER \
--nocfg
fi

db_get interchange-cat-standard/install
if [ "$RET" = "true" ]; then
db_get interchange/full_url
if [ "$RET" = "true" ]; then
db_get interchange-cat-standard/vhost
URLS="$RET/cgi-bin/ic/standard $RET:443/cgi-bin/ic/standard"
else
URLS="/cgi-bin/ic/standard"
fi
cat <<EOF >/var/lib/interchange/catalog.d/interchange-cat-standard.cfg
include usertag/standard/*
require module Vend::Payment::TestPayment
Catalog standard /var/lib/interchange/catalogs/standard $URLS
EOF
if [ ! -f /var/run/interchange-install ]; then
# add catalog to running server
echo "Catalog standard /var/lib/interchange/catalogs/standard $URLS" | /usr/sbin/interchange --add standard
fi
fi

#DEBHELPER#
Something went wrong with that request. Please try again.