2 # postinst script for lx-office-erp-svn
4 # see: dh_installdeb(1)
10 echo "! Postinst $1 !"
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.sh.."
31 cd /usr/lib/lx-office-erp/
33 ./scripts/inst_postgres_deb.sh
35 echo "Factory postgresql config script done."
39 config_postgresql_accounts_sec() {
41 POSTGRESQL_PG_HBA_CONF="/etc/postgresql/8.3/main/pg_hba.conf"
43 echo "# added by lx-office-erp postinst-script" >> $POSTGRESQL_PG_HBA_CONF
44 echo "host all lx_office_erp 127.0.0.1 255.255.255.0 password" >> $POSTGRESQL_PG_HBA_CONF
46 /etc/init.d/postgresql* reload
50 config_postgresql_roles() {
52 echo "CREATE USER lx_office_erp with CREATEDB ;" > /tmp/lxdb-install.sql
54 db_get lx-office-erp/lx-office-erp-user-postgresql-password
55 POSTGRES_LX_OFFICE_ERP_USER_PASSWORD="$RET"
57 echo "ALTER USER lx_office_erp PASSWORD '$POSTGRES_LX_OFFICE_ERP_USER_PASSWORD' ;" \
58 >> /tmp/lxdb-install.sql
60 echo "UPDATE pg_language SET lanpltrusted = true WHERE lanname = 'plpgsql';" >> /tmp/lxdb-instal.sql
62 su postgres -c "psql --dbname template1 < /tmp/lxdb-install.sql"
64 /etc/init.d/postgresql* reload
69 config_postgresql_sql_routines() {
71 PLPGSQL="/usr/lib/postgresql/8.3/lib/plpgsql.so"
72 echo "CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler" > /tmp/lxdb-install.sql
73 echo "AS '$PLPGSQL', 'plpgsql_call_handler'" >> /tmp/lxdb-install.sql
74 echo "LANGUAGE c;" >> /tmp/lxdb-install.sql
75 echo "CREATE PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;" >> /tmp/lxdb-install.sql
76 su postgres -c "psql --dbname template1 < /tmp/lxdb-install.sql"
78 /etc/init.d/postgresql-8.3 reload
82 set_lx_office_erp_web_admin_password() {
84 db_get lx-office-erp/admin-password
87 cat /usr/lib/lx-office-erp/config/authentication.pl.default | \
88 sed --expression "s/\$self->{admin_password} = 'admin';/\$self->{admin_password} = '$ADMINPASSWORD';/g" \
91 mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl
93 chmod 0600 /usr/lib/lx-office-erp/config/authentication.pl
94 chown www-data:www-data /usr/lib/lx-office-erp/config/authentication.pl
99 set_lx_office_erp_authentication_db_password() {
100 db_get lx-office-erp/lx-office-erp-user-postgresql-password
103 cat /usr/lib/lx-office-erp/config/authentication.pl | \
104 sed --expression "s/'password' => '',/'password' => '$PASSWORD',/g" \
107 mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl
111 set_lx_office_erp_authentication_db_user() {
114 cat /usr/lib/lx-office-erp/config/authentication.pl | \
115 sed --expression "s/'user' => 'postgres',/'user' => '$USER',/g" \
118 mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl
122 disable_ipv6_on_lo_interface() {
124 # Perls Libraries are not yet ipv6 read
125 echo "WICHTIG: ipv6 ist nunmehr auf dem Loopback-Interface deaktiviert, um die Funktionsfähigkeit von Lx-Office-ERP zu gewährleisten!"
126 ifconfig lo inet6 del ::1/128 2> /dev/null || true
128 # make the changes permanent (triggered on next reboot)
129 RCLOCAL="/etc/rc.local"
130 echo "# lx-office-erp: Perl libraries are not yet fully ipv6-ready" >> $RCLOCAL
131 echo "ifconfig lo inet6 del ::1/128" >> $RCLOCAL
147 # config_postgresql_sql_routines
148 # config_postgresql_roles
149 # config_postgresql_accounts_sec
151 config_postgresql_factory_script
153 chown -R www-data:www-data /usr/lib/lx-office-erp/users
154 chown -R www-data:www-data /usr/lib/lx-office-erp/templates
156 set_lx_office_erp_web_admin_password
157 set_lx_office_erp_authentication_db_user
158 set_lx_office_erp_authentication_db_password
160 disable_ipv6_on_lo_interface
162 /etc/init.d/apache* reload
166 abort-upgrade|abort-remove|abort-deconfigure)
170 echo "postinst called with unknown argument \`$1'" >&2
175 # dh_installdeb will replace this with shell code automatically
176 # generated by other debhelper scripts.