postinst is in otrs2 6.0.5-1.
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 | #!/bin/sh
set -e
OTRSHOME=/usr/share/otrs
OTRS_VAR=/var/lib/otrs
CONFIGFILES="Kernel/Config.pm"
setup_database(){
. /usr/share/dbconfig-common/dpkg/postinst
dbc_generate_include="perl:/etc/otrs/database.pm"
dbc_generate_include_owner="otrs:www-data"
dbc_generate_include_perms="0640"
dbc_first_version="2.0.4p01-10"
dbc_mysql_createdb_encoding="UTF8"
dbc_go otrs2 "$@"
}
setup_cron(){
# register the new cron config
TMPFILE=$(mktemp)
cat /var/lib/otrs/cron/* > $TMPFILE
ucf --three-way --debconf-ok $TMPFILE /etc/otrs/cron
rm -f $TMPFILE
if [ ! -e /etc/cron.d/otrs2 ] && [ ! -e /etc/cron.d/otrs ]; then
ln -s /etc/otrs/cron /etc/cron.d/otrs2
fi
}
setup_apache(){
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enmod perl
apache2_invoke enmod rewrite
apache2_invoke enmod headers
apache2_invoke enmod deflate
fi
db_stop
}
. /usr/share/debconf/confmodule
case "$1" in
configure|reconfigure)
setup_database "$@"
for FILE in $CONFIGFILES; do
ucf --three-way --debconf-ok $OTRSHOME/$FILE.dist /etc/otrs/$FILE
done
setup_cron
ucf --three-way --debconf-ok $OTRSHOME/.fetchmailrc.dist /etc/otrs/fetchmailrc
chmod 600 /etc/otrs/fetchmailrc
setup_apache $@
if [ -f /etc/otrs/database.pm ]; then
cd $OTRSHOME && ./bin/otrs.Console.pl Maint::Config::Rebuild --allow-root > /dev/null
cd $OTRSHOME && ./bin/otrs.Console.pl Maint::Cache::Delete --allow-root > /dev/null || true
fi
chown otrs:www-data /var/spool/otrs
chmod 0775 /var/spool/otrs
# Set required permissions, which were set by otrs.SetPermissions.pl in the past
if [ ! -f $OTRS_VAR/log/TicketCounter.log ]; then
echo '' > $OTRS_VAR/log/TicketCounter.log
fi
chown otrs:www-data $OTRS_VAR/log/TicketCounter.log
chmod 0664 $OTRS_VAR/log/TicketCounter.log
chown otrs:www-data $OTRS_VAR/article
chmod 2775 $OTRS_VAR/article
chown otrs:www-data $OTRS_VAR/log
chmod 2775 $OTRS_VAR/log
chown otrs:www-data $OTRS_VAR/sessions
chmod 2775 $OTRS_VAR/sessions
chown otrs:www-data $OTRS_VAR/processes
chmod 2775 $OTRS_VAR/processes
chown otrs:www-data $OTRS_VAR/webservices
chmod 2775 $OTRS_VAR/webservices
chown otrs:www-data -R $OTRS_VAR/stats
chmod 2775 $OTRS_VAR/stats
chown otrs:www-data -R $OTRS_VAR/tmp
find $OTRS_VAR/tmp -type d -exec chmod 2775 {} \;
find $OTRS_VAR/httpd/htdocs/ -type d -name \*-cache -exec chown otrs:www-data {} \;
find $OTRS_VAR/httpd/htdocs/ -type d -name \*-cache -exec chmod 2775 {} \;
find $OTRS_VAR/Config/Files/ -type f -name \*.pm -exec chmod 0660 {} \;
find $OTRS_VAR/Config/Files/ -type f -name \*.xml -exec chmod 0660 {} \;
find $OTRS_VAR/Config/ -type d -exec chmod 2770 {} \;
find $OTRS_VAR/Config/ -exec chown otrs:www-data {} \;
;;
install)
;;
*)
echo "postinst called with unknown argument \`$1'" 1>&2
exit 1
;;
esac
if [ -e /usr/share/apache2/apache2-maintscript-helper ] ; then
. /usr/share/apache2/apache2-maintscript-helper
apache2_invoke enconf otrs2.conf
fi
|