X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=DEBIAN%2FDEBIAN%2Fpostinst;h=5604cd99cb342daa1c62567e94d735fda5274b82;hb=606e7e2575ff6112e8e45acf0e74e87faa5cfa7c;hp=cfcaa85384b012b101bacba41ec680149b9567d2;hpb=ba11416b58220da04fd7941fc32471e37a1c00f8;p=kivitendo-erp.git diff --git a/DEBIAN/DEBIAN/postinst b/DEBIAN/DEBIAN/postinst index cfcaa8538..5604cd99c 100755 --- a/DEBIAN/DEBIAN/postinst +++ b/DEBIAN/DEBIAN/postinst @@ -7,7 +7,7 @@ set -e # x = xtrace #set -x -echo "! Postinst $1 !" +echo " ! "`date`" Postinst $1 !" >> /tmp/lxo-erp.log source /usr/share/debconf/confmodule @@ -26,12 +26,9 @@ source /usr/share/debconf/confmodule config_postgresql_factory_script() { - echo "Starting factory postgresql config script: scripts/inst_postgres.sh.." - + echo "Starting factory postgresql config script: scripts/inst_postgres_deb.sh.." cd /usr/lib/lx-office-erp/ - ./scripts/inst_postgres_deb.sh - echo "Factory postgresql config script done." } @@ -81,45 +78,46 @@ config_postgresql_sql_routines() { set_lx_office_erp_web_admin_password() { + if ! [ -f /etc/lx-office-erp/lx_office.conf ] ; then + cp /etc/lx-office-erp/lx_office.conf.default /etc/lx-office-erp/lx_office.conf + fi db_get lx-office-erp/admin-password ADMINPASSWORD="$RET" - cat /usr/lib/lx-office-erp/config/authentication.pl.default | \ - sed --expression "s/\$self->{admin_password} = 'admin';/\$self->{admin_password} = '$ADMINPASSWORD';/g" \ + cat /etc/lx-office-erp/lx_office.conf | \ + sed --expression "s/admin_password = /admin_password = $ADMINPASSWORD/g" \ > /tmp/1.txt - mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl - - chmod 0600 /usr/lib/lx-office-erp/config/authentication.pl - chown www-data:www-data /usr/lib/lx-office-erp/config/authentication.pl + mv /tmp/1.txt /etc/lx-office-erp/lx_office.conf } -set_lx_office_erp_authentication_db_password() { +set_lx_office_erp_authentication_db_user_password() { db_get lx-office-erp/lx-office-erp-user-postgresql-password PASSWORD="$RET" - cat /usr/lib/lx-office-erp/config/authentication.pl | \ - sed --expression "s/'password' => '',/'password' => '$PASSWORD',/g" \ + cat /etc/lx-office-erp/lx_office.conf | \ + sed --expression "s/^password = /password = $PASSWORD/g" \ > /tmp/1.txt - mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl + cat /tmp/1.txt | \ + sed --expression "s/^user = postgres/user = lxoffice/g" \ + > /etc/lx-office-erp/lx_office.conf } -set_lx_office_erp_authentication_db_user() { - USER="lxoffice" - - cat /usr/lib/lx-office-erp/config/authentication.pl | \ - sed --expression "s/'user' => 'postgres',/'user' => '$USER',/g" \ - > /tmp/1.txt - mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl +set_user_rights() { + chown -R www-data:www-data /usr/lib/lx-office-erp/users + chown -R www-data:www-data /usr/lib/lx-office-erp/templates + chown www-data:www-data /etc/lx-office-erp/lx_office.conf + chown www-data:www-data /usr/lib/lx-office-erp/menu.ini + chmod 0600 /etc/lx-office-erp/lx_office.conf } - disable_ipv6_on_lo_interface() { + #Ist wohl nicht mehr notwendig. # 2009-04-25 # Perls Libraries are not yet ipv6 read echo "WICHTIG: ipv6 ist nunmehr auf dem Loopback-Interface deaktiviert, um die Funktionsfähigkeit von Lx-Office-ERP zu gewährleisten!" @@ -131,35 +129,99 @@ disable_ipv6_on_lo_interface() { echo "ifconfig lo inet6 del ::1/128" >> $RCLOCAL } +mk_new_menu() { + if [ -e /usr/lib/lx-office-crm ] ; then + #crm vorhanden, dann die menu.ini mit der höchsten VersNr nehmen + for i in `ls -1 /usr/lib/lx-office-crm/update/menu*ini` ; do + cat $i > /usr/lib/lx-office-erp/menu.ini + done; + cat /usr/lib/lx-office-erp/menu.default >> /usr/lib/lx-office-erp/menu.ini + else + cp /usr/lib/lx-office-erp/menu.default /usr/lib/lx-office-erp/menu.ini + fi +} +mk_new_config() { + if ! [ -f /etc/lx-office-erp/lx_office.conf ] ; then + cp /etc/lx-office-erp/lx_office.conf.default /etc/lx-office-erp/lx_office.conf + fi +} - - +mk_links() { + if ! [ -f /usr/lib/lx-office-erp/config/lx_office.conf ] ; then + ln -s /etc/lx-office-erp/lx_office.conf /usr/lib/lx-office-erp/config/lx_office.conf + fi; + if ! [ -f /usr/lib/lx-office-erp/config/lx_office.conf.default ] ; then + ln -s /etc/lx-office-erp/lx_office.conf.default /usr/lib/lx-office-erp/config/lx_office.conf.default + fi; + if [ -e /etc/lx-office-erp/authentication.pl ] ; then + rm /etc/lx-office-erp/authentication.pl + fi + if [ -e /etc/apache2 ] ; then + if ! [ -f /etc/apache2/conf.d/lx-office-erp.apache2.conf ] ; then + ln -s /etc/lx-office-erp/lx-office-erp.apache2.conf /etc/apache2/conf.d/lx-office-erp.apache2.conf + fi; + fi; + if [ -e /etc/cherokee/sites-available ] ; then + if ! [ -f /etc/cherokee/sites-available/lx-office-erp.cherokee ] ; then + cat /etc/lx-office-erp/lx-office-erp.cherokee.handler >> /etc/cherokee/sites-available/default + ln -s /etc/lx-office-erp/lx-office-erp.cherokee /etc/cherokee/sites-available/lx-office-erp.cherokee + fi; + fi; + if [ -e /etc/lighttpd ] ; then + if ! [ -f /etc/lighttpd/conf-enabled/lx-office-erp.lighttpd ] ; then + ln -s /etc/lx-office-erp/lx-office-erp.lighttpd /etc/lighttpf/conf-enabled/10-lx-office-erp + fi; + fi; +} +reload_web_server() { + if [ -f /etc/init.d/apache* ] ; then + /etc/init.d/apache* reload + fi + if [ -f /etc/init.d/cherokee ] ; then + /etc/init.d/cherokee reload + fi + if [ -f /etc/init.d/lighttpd ] ; then + /etc/init.d/lighttpd reload + fi +} case "$1" in - install) - echo "Install" upgrade) - echo "Upgrade" - - configure) - -# config_postgresql_sql_routines -# config_postgresql_roles -# config_postgresql_accounts_sec + echo " ! "`date`" $1 !" >> /tmp/lxo-erp.log + + VER=`cat /var/www/lx-office-erp/VERSION | cut -d '.' -f2` + if [ $VER = '6' ]; then + echo " ! 2.6 !" >> /tmp/lxo-erp.log + echo "Version 2.6.x" + mk_new_menu + else + mk_new_menu + mk_new_config + config_postgresql_factory_script + set_lx_office_erp_web_admin_password + set_lx_office_erp_authentication_db_user_password + # disable_ipv6_on_lo_interface + mk_links + fi; + + set_user_rights + reload_web_server + ;; - config_postgresql_factory_script + install|configure) + echo " ! "`date`" $1 !" >> /tmp/lxo-erp.log - chown -R www-data:www-data /usr/lib/lx-office-erp/users - chown -R www-data:www-data /usr/lib/lx-office-erp/templates + mk_new_menu + mk_new_config + config_postgresql_factory_script + set_lx_office_erp_web_admin_password + set_lx_office_erp_authentication_db_user_password + # disable_ipv6_on_lo_interface + mk_links - set_lx_office_erp_web_admin_password - set_lx_office_erp_authentication_db_user - set_lx_office_erp_authentication_db_password - - disable_ipv6_on_lo_interface - - /etc/init.d/apache* reload + set_user_rights + reload_web_server ;; @@ -176,7 +238,6 @@ esac # generated by other debhelper scripts. - echo "done!!" exit 0