Skip to content
This repository
tag: REL_5_7_2
Fetching contributors…

Cannot retrieve contributors at this time

file 148 lines (124 sloc) 3.814 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 145 146 147 148
#! /bin/sh
#
# Copyright 2001,2002,2003,2004,2006,2007 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

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

# Creating interchange group if he isn't already there
if ! grep -q ^$GROUP: /etc/group; then
        echo Adding system group: $GROUP.
        addgroup --system $GROUP
fi

# Creating interchange user if he isn't already there
if ! grep -q ^$USER: /etc/passwd; then
        echo Adding system user: $USER.
        adduser --system --ingroup $GROUP --home /usr/lib/interchange $USER
fi

# Ensure correct permissions for directories with log files resp. PID file
chown -R $USER.$GROUP /var/log/interchange
chmod 770 /var/log/interchange
chown -R $USER.$GROUP /var/run/interchange
chown -R $USER.$GROUP /usr/lib/cgi-bin/ic
chmod u+s /usr/lib/cgi-bin/ic/*

# Ensure correct permissions for catalog base directory
# and static HTML base directory

chown $USER.$GROUP /var/lib/interchange/catalogs
db_get interchange/docroot
if [ -d "$RET" ]; then
chown $USER.$GROUP "$RET"
fi

# More permissions

chown -R $USER.$GROUP /etc/interchange/usertag
chown -R $USER.$GROUP /var/lib/interchange/catalog.d

# Record debconf configuration in multiple files
# 1. Stuff needed for the init script

INITCFG=/etc/interchange/init.cfg
cat > $INITCFG <<EOF
# This file is automatically generated !
#
# YOU MAY MODIFY THIS FILE
# But we recommend to use dpkg-reconfigure interchange instead.

EOF

db_get interchange/mode
case "$RET" in
"unix mode") MODE=--unix;;
"internet mode") MODE=--inetmode;;
"both") MODE="--unix --inetmode";;
esac
echo MODE=\"$MODE\" >> $INITCFG
echo USER=$USER >> $INITCFG
echo GROUP=$GROUP >> $INITCFG

db_get interchange/docroot
echo DOCROOT=$RET >> $INITCFG

db_get interchange/gpghome
echo GPGHOME=$RET >> $INITCFG

# 2. Settings which influence the global configuration
# and make senses to be configured by debconf

db_get interchange/full_url
if [ "$RET" = true ]; then
FULL_URL=1
else
FULL_URL=0
fi
db_get interchange/cansoap
SOAP=0
if [ "$RET" = true ]; then
db_get interchange/soap
if [ "$RET" = true ]; then
SOAP=1
fi
fi
db_get interchange/traffic
TRAFFIC="$RET"

/usr/sbin/interchangeconfig FULL_URL=$FULL_URL SOAP=$SOAP TRAFFIC=$RET

# Make configuration files owned by the interchange user
chown -R $USER.$GROUP /etc/interchange

# Create directory for static HTML files and grant it to the
# interchange user
db_get interchange/docroot
DOCROOT="$RET"
if [ "$DOCROOT" ]; then
mkdir -p -m 755 $DOCROOT
chown $USER.$GROUP $DOCROOT
fi

# Check if we delay the startup
if [ -f /var/run/interchange-install ]; then
PACKAGES=""
exec 4</var/run/interchange-install
while read <&4 PKG; do
if [ ! "$PKG" = "interchange" ]; then
PACKAGES="$PKG $PACKAGES"
fi
done
if [ -z "$PACKAGES" ]; then
rm /var/run/interchange-install
else
exec 5>/var/run/interchange-install
for PKG in $PACKAGES; do
echo "$PKG" >&5
done
fi
fi

#DEBHELPER#

# Don't wait on Interchange to close file handles
db_stop

exit 0
Something went wrong with that request. Please try again.