2 # postinst script for lx-office-erp-svn
4 # see: dh_installdeb(1)
10 echo " ! "`date`" Postinst $1 !" >> /tmp/lxo-erp.log
12 source /usr/share/debconf/confmodule
14 # summary of how this script can be called:
15 # * <postinst> `configure' <most-recently-configured-version>
16 # * <old-postinst> `abort-upgrade' <new version>
17 # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
19 # * <postinst> `abort-remove'
20 # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
21 # <failed-install-package> <version> `removing'
22 # <conflicting-package> <version>
23 # for details, see http://www.debian.org/doc/debian-policy/ or
24 # the debian-policy package
27 config_postgresql_factory_script() {
29 echo "Starting factory postgresql config script: scripts/inst_postgres_deb.sh.."
30 cd /usr/lib/lx-office-erp/
31 ./scripts/inst_postgres_deb.sh
32 echo "Factory postgresql config script done."
36 config_postgresql_accounts_sec() {
38 POSTGRESQL_PG_HBA_CONF="/etc/postgresql/8.3/main/pg_hba.conf"
40 echo "# added by lx-office-erp postinst-script" >> $POSTGRESQL_PG_HBA_CONF
41 echo "host all lx_office_erp 127.0.0.1 255.255.255.0 password" >> $POSTGRESQL_PG_HBA_CONF
43 /etc/init.d/postgresql* reload
47 config_postgresql_roles() {
49 echo "CREATE USER lx_office_erp with CREATEDB ;" > /tmp/lxdb-install.sql
51 db_get lx-office-erp/lx-office-erp-user-postgresql-password
52 POSTGRES_LX_OFFICE_ERP_USER_PASSWORD="$RET"
54 echo "ALTER USER lx_office_erp PASSWORD '$POSTGRES_LX_OFFICE_ERP_USER_PASSWORD' ;" \
55 >> /tmp/lxdb-install.sql
57 echo "UPDATE pg_language SET lanpltrusted = true WHERE lanname = 'plpgsql';" >> /tmp/lxdb-instal.sql
59 su postgres -c "psql --dbname template1 < /tmp/lxdb-install.sql"
61 /etc/init.d/postgresql* reload
66 config_postgresql_sql_routines() {
68 PLPGSQL="/usr/lib/postgresql/8.3/lib/plpgsql.so"
69 echo "CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler" > /tmp/lxdb-install.sql
70 echo "AS '$PLPGSQL', 'plpgsql_call_handler'" >> /tmp/lxdb-install.sql
71 echo "LANGUAGE c;" >> /tmp/lxdb-install.sql
72 echo "CREATE PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;" >> /tmp/lxdb-install.sql
73 su postgres -c "psql --dbname template1 < /tmp/lxdb-install.sql"
75 /etc/init.d/postgresql-8.3 reload
79 set_lx_office_erp_web_admin_password() {
80 db_get lx-office-erp/admin-password
83 sed --in-place --expression "s/^admin_password.*=.*/admin_password = $ADMINPASSWORD/" /etc/lx-office-erp/lx_office.conf
87 set_lx_office_erp_authentication_db_user_password() {
88 db_get lx-office-erp/lx-office-erp-user-postgresql-password
91 sed --in-place --expression "s/^password.*=.*/password = $PASSWORD/" /etc/lx-office-erp/lx_office.conf
92 sed --in-place --expression "s/^user.*=.*postgres/user = lxoffice/g" /etc/lx-office-erp/lx_office.conf
97 chown -R www-data:www-data /usr/lib/lx-office-erp/users
98 chown -R www-data:www-data /usr/lib/lx-office-erp/templates
99 chown www-data:www-data /etc/lx-office-erp/lx_office.conf
100 chown www-data:www-data /usr/lib/lx-office-erp/menu.ini
101 chmod 0600 /etc/lx-office-erp/lx_office.conf
104 disable_ipv6_on_lo_interface() {
105 #Ist wohl nicht mehr notwendig.
107 # Perls Libraries are not yet ipv6 read
108 echo "WICHTIG: ipv6 ist nunmehr auf dem Loopback-Interface deaktiviert, um die Funktionsfähigkeit von Lx-Office-ERP zu gewährleisten!"
109 ifconfig lo inet6 del ::1/128 2> /dev/null || true
111 # make the changes permanent (triggered on next reboot)
112 RCLOCAL="/etc/rc.local"
113 echo "# lx-office-erp: Perl libraries are not yet fully ipv6-ready" >> $RCLOCAL
114 echo "ifconfig lo inet6 del ::1/128" >> $RCLOCAL
118 if [ -e /usr/lib/lx-office-crm ] ; then
119 #crm vorhanden, dann die menu.ini mit der höchsten VersNr nehmen
120 for i in `ls -1 /usr/lib/lx-office-crm/update/menu*ini` ; do
121 cat $i > /usr/lib/lx-office-erp/menu.ini
123 cat /usr/lib/lx-office-erp/menu.default >> /usr/lib/lx-office-erp/menu.ini
125 cp /usr/lib/lx-office-erp/menu.default /usr/lib/lx-office-erp/menu.ini
130 if ! [ -f /etc/lx-office-erp/lx_office.conf ] ; then
131 cp /etc/lx-office-erp/lx_office.conf.default /etc/lx-office-erp/lx_office.conf
136 if ! [ -f /usr/lib/lx-office-erp/config/lx_office.conf ] ; then
137 ln -s /etc/lx-office-erp/lx_office.conf /usr/lib/lx-office-erp/config/lx_office.conf
139 if [ -e /etc/apache2 ] ; then
140 if ! [ -f /etc/apache2/conf.d/lx-office-erp.apache2.conf ] ; then
141 ln -s /etc/lx-office-erp/lx-office-erp.apache2.conf /etc/apache2/conf.d/lx-office-erp.apache2.conf
144 if [ -e /etc/cherokee/sites-available ] ; then
145 if ! [ -f /etc/cherokee/sites-available/lx-office-erp.cherokee ] ; then
146 cat /etc/lx-office-erp/lx-office-erp.cherokee.handler >> /etc/cherokee/sites-available/default
147 ln -s /etc/lx-office-erp/lx-office-erp.cherokee /etc/cherokee/sites-available/lx-office-erp.cherokee
150 if [ -e /etc/lighttpd ] ; then
151 if ! [ -f /etc/lighttpd/conf-enabled/lx-office-erp.lighttpd ] ; then
152 ln -s /etc/lx-office-erp/lx-office-erp.lighttpd /etc/lighttpf/conf-enabled/10-lx-office-erp
156 reload_web_server() {
157 if [ -f /etc/init.d/apache* ] ; then
158 /etc/init.d/apache* reload
160 if [ -f /etc/init.d/cherokee ] ; then
161 /etc/init.d/cherokee reload
163 if [ -f /etc/init.d/lighttpd ] ; then
164 /etc/init.d/lighttpd reload
170 echo " ! "`date`" $1 !" >> /tmp/lxo-erp.log
172 VER=`cat /var/www/lx-office-erp/VERSION | cut -d '.' -f2`
173 if [ $VER = '7' ]; then
174 echo " ! 2.7 !" >> /tmp/lxo-erp.log
180 config_postgresql_factory_script
181 set_lx_office_erp_web_admin_password
182 set_lx_office_erp_authentication_db_user_password
183 # disable_ipv6_on_lo_interface
192 echo " ! "`date`" $1 !" >> /tmp/lxo-erp.log
196 config_postgresql_factory_script
197 set_lx_office_erp_web_admin_password
198 set_lx_office_erp_authentication_db_user_password
199 # disable_ipv6_on_lo_interface
207 abort-upgrade|abort-remove|abort-deconfigure)
211 echo "postinst called with unknown argument \`$1'" >&2
216 # dh_installdeb will replace this with shell code automatically
217 # generated by other debhelper scripts.