This file is indexed.

postinst is in interchange-cat-standard 5.7.7-2.

This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.

The actual contents of the file can be viewed below.

  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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
#! /bin/sh -e
#
# Copyright 2001,2004,2005,2006,2008,2009 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

# Call dbconfig-common hook
. /usr/share/dbconfig-common/dpkg/postinst
dbc_go interchange-cat-standard $@

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
	SQLITE=0
	SQLDSN=
	db_get interchange-cat-standard/dbtype
	if [ "$dbc_dbtype" = "mysql" ]; then
		MYSQL=1
		SQLDSN="dbi:mysql:$dbc_dbname"
	elif [ "$dbc_dbtype" = "pgsql" ]; then
		PGSQL=1
		SQLDSN="dbi:Pg:dbname=$dbc_dbname"
	elif [ "$dbc_dbtype" = "sqlite" ]; then
		SQLITE=1
		SQLDSN="dbi:SQLite:dbname=$dbc_dbname"
	fi

	# with full URL enabled we use virtual host provided by the user
	db_get interchange/full_url
	if [ "$RET" = "true" ]; then
		db_get interchange-cat-standard/vhost
		SERVERNAME="$RET"
	else
		SERVERNAME=`hostname --fqdn 2>/dev/null || echo localhost`
	fi

	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 \
		-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 \
		MYSQLCREATE=0 \
		SQLDSN="$SQLDSN" \
		SQLUSER="$dbc_dbuser" \
		SQLPASS="$dbc_dbpass"
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" | interchange --add standard
	fi
fi