From: Sven Schöling Date: Thu, 27 Jan 2011 10:30:00 +0000 (+0100) Subject: Merge branch 'master' of git@lx-office.linet-services.de:lx-office-erp X-Git-Tag: release-2.6.2~23 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/49064c915322ecd425e738516c4a5ce46516ffeb?hp=8d38eed850ea21bdc5b9725e043d7b2f95ce1ace Merge branch 'master' of git@lx-office.linet-services.de:lx-office-erp --- diff --git a/DEBIAN/DEBIAN/conffiles b/DEBIAN/DEBIAN/conffiles index 4cb0a3b35..1a88f8fcf 100644 --- a/DEBIAN/DEBIAN/conffiles +++ b/DEBIAN/DEBIAN/conffiles @@ -1,3 +1,6 @@ /etc/lx-office-erp/lx-office-erp.apache2.conf /etc/lx-office-erp/lx-office-erp.cherokee /etc/lx-office-erp/lx-office-erp.cherokee.handler +/etc/lx-office-erp/lx-erp.conf.default +/etc/lx-office-erp/console.conf.default +/etc/lx-office-erp/authentication.pl.default diff --git a/DEBIAN/DEBIAN/control b/DEBIAN/DEBIAN/control index e07492cf0..f47766de3 100644 --- a/DEBIAN/DEBIAN/control +++ b/DEBIAN/DEBIAN/control @@ -5,8 +5,8 @@ Section: universe/web Priority: optional Installed-Size: 0 Maintainer: Holger Lindemann , Adrian Weibel -Depends: patch, apache2 | apache | lighttpd, postgresql | postgresql-8.2 | postgresql-8.3 | postgresql-8.4, libdbi-perl, libdbd-pg-perl, libpg-perl, libarchive-zip-perl, libyaml-perl, libio-stringy-perl, libtemplate-perl, libpdf-api2-perl, libcgi-ajax-perl, liblist-moreutils-perl, libxml-writer-perl, libtext-csv-xs-perl | libtext-csv-perl, liburi-perl, libdatetime-perl, libtext-iconv-perl, libclass-accessor-perl,libemail-address-perl,libparent-perl -Suggests: tetex-base, tetex-bin, tetex-extra, xpdf | evince | okular, libfcgi-perl, libapache2-mod-fastcgi +Depends: patch, apache2 | apache | lighttpd, postgresql-8.2 | postgresql-8.3 | postgresql-8.4, libdbi-perl, libdbd-pg-perl, libpg-perl, libarchive-zip-perl, libyaml-perl, libio-stringy-perl, libtemplate-perl, libpdf-api2-perl, libcgi-ajax-perl, liblist-moreutils-perl, libxml-writer-perl, libtext-csv-xs-perl | libtext-csv-perl, liburi-perl, libdatetime-perl, libtext-iconv-perl, libclass-accessor-perl,libemail-address-perl,libparent-perl, librose-object-perl, librose-db-perl, librose-db-object-perl +Suggests: tetex-base | texlive-latex-base, tetex-bin | texlive-base-bin , tetex-extra | texlive-latex-extra, xpdf | evince | okular, libfcgi-perl, libapache2-mod-fastcgi Homepage: http://www.lx-office.org Description: Extended double entry accounting system for the german market. Lx-Office is derived from sql-ledger and rewritten diff --git a/DEBIAN/DEBIAN/postinst b/DEBIAN/DEBIAN/postinst index 54b53e5da..0e0da1365 100755 --- a/DEBIAN/DEBIAN/postinst +++ b/DEBIAN/DEBIAN/postinst @@ -81,17 +81,12 @@ set_lx_office_erp_web_admin_password() { db_get lx-office-erp/admin-password ADMINPASSWORD="$RET" - #cat /usr/lib/lx-office-erp/config/authentication.pl.default | \ cat /etc/lx-office-erp/authentication.pl.default | \ sed --expression "s/\$self->{admin_password} = 'admin';/\$self->{admin_password} = '$ADMINPASSWORD';/g" \ > /tmp/1.txt - #mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl mv /tmp/1.txt /etc/lx-office-erp/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 - } @@ -99,12 +94,10 @@ set_lx_office_erp_authentication_db_password() { db_get lx-office-erp/lx-office-erp-user-postgresql-password PASSWORD="$RET" - #cat /usr/lib/lx-office-erp/config/authentication.pl | \ cat /etc/lx-office-erp/authentication.pl | \ sed --expression "s/'password' => '',/'password' => '$PASSWORD',/g" \ > /tmp/1.txt - #mv /tmp/1.txt /usr/lib/lx-office-erp/config/authentication.pl mv /tmp/1.txt /etc/lx-office-erp/authentication.pl } @@ -112,23 +105,21 @@ set_lx_office_erp_authentication_db_password() { set_lx_office_erp_authentication_db_user() { USER="lxoffice" - #cat /usr/lib/lx-office-erp/config/authentication.pl | \ cat /etc/lx-office-erp/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 mv /tmp/1.txt /etc/lx-office-erp/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-erp.conf - chown www-data:www-data /usr/lib/lx-office-erp/menu.ini - chown www-data:www-data /etc/lx-office-erp/authentication.pl - chmod 0600 /etc/lx-office-erp/lx-erp.conf - chmod 0600 /etc/lx-office-erp/authentication.pl + chown www-data:www-data /etc/lx-office-erp/lx-erp.conf + chown www-data:www-data /usr/lib/lx-office-erp/menu.ini + chown www-data:www-data /etc/lx-office-erp/authentication.pl + chmod 0600 /etc/lx-office-erp/lx-erp.conf + chmod 0600 /etc/lx-office-erp/authentication.pl } disable_ipv6_on_lo_interface() { @@ -159,6 +150,9 @@ mk_new_config() { if ! [ -f /etc/lx-office-erp/lx-erp.conf ] ; then cp /etc/lx-office-erp/lx-erp.conf.default /etc/lx-office-erp/lx-erp.conf fi + if ! [ -f /etc/lx-office-erp/console.conf ] ; then + cp /etc/lx-office-erp/console.conf.default /etc/lx-office-erp/console.conf + fi } mk_links() { @@ -168,6 +162,9 @@ mk_links() { if ! [ -f /usr/lib/lx-office-erp/config/lx-erp.conf ] ; then ln -s /etc/lx-office-erp/lx-erp.conf /usr/lib/lx-office-erp/config/lx-erp.conf fi; + if ! [ -f /usr/lib/lx-office-erp/config/console.conf ] ; then + ln -s /etc/lx-office-erp/console.conf /usr/lib/lx-office-erp/config/console.conf + 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 diff --git a/DEBIAN/DEBIAN/preinst b/DEBIAN/DEBIAN/preinst index 03b19fa40..1d39870b7 100755 --- a/DEBIAN/DEBIAN/preinst +++ b/DEBIAN/DEBIAN/preinst @@ -2,10 +2,14 @@ #Nur für das Update von einer 2.6.0 nötig, da hier gnadenlos gelöscht wird set -e echo " ! "`date`" Preinst $1 !" >> /tmp/lxo-erp.log + if [ "$1" = "upgrade" ]; then - echo "#!/bin/sh" > /var/lib/dpkg/info/lx-office-erp.postrm - echo "set -e" >> /var/lib/dpkg/info/lx-office-erp.postrm - echo "echo ' ! '`date`' postrm2 $1 !'" >> /var/lib/dpkg/info/lx-office-erp.postrm - chmod +x /var/lib/dpkg/info/lx-office-erp.postrm + cnt=`grep -c '\-e /usr/lib/lx-office-erp' /var/lib/dpkg/info/lx-office-erp.postrm` + if ! [ $cnt == 0 ]; then + echo "#!/bin/sh" > /var/lib/dpkg/info/lx-office-erp.postrm + echo "set -e" >> /var/lib/dpkg/info/lx-office-erp.postrm + echo "echo ' ! '`date`' postrm2 $1 !'" >> /var/lib/dpkg/info/lx-office-erp.postrm + chmod +x /var/lib/dpkg/info/lx-office-erp.postrm + fi fi diff --git a/DEBIAN/files/lx-office-erp b/DEBIAN/files/lx-office-erp deleted file mode 100755 index 7f41914ea..000000000 --- a/DEBIAN/files/lx-office-erp +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -## shell script for lx-office-erp to start the login manager in a browser - -set -e - -/usr/bin/sensible-browser http://localhost/lx-office-erp/login.pl - - diff --git a/DEBIAN/files/lx-office-erp.1.gz b/DEBIAN/files/lx-office-erp.1.gz deleted file mode 100644 index d68e3a64a..000000000 Binary files a/DEBIAN/files/lx-office-erp.1.gz and /dev/null differ diff --git a/DEBIAN/files/lx-office-erp.apache2.conf b/DEBIAN/files/lx-office-erp.apache2.conf deleted file mode 100644 index b9a4aaf9b..000000000 --- a/DEBIAN/files/lx-office-erp.apache2.conf +++ /dev/null @@ -1,14 +0,0 @@ -AddHandler cgi-script .pl -Alias /lx-office /usr/lib/lx-office-erp/ -Alias /lx-office-erp /usr/lib/lx-office-erp/ - - - Options ExecCGI Includes FollowSymlinks - DirectoryIndex login.pl - AddDefaultCharset UTF-8 - - - - Order Deny,Allow - Deny from All - \ No newline at end of file diff --git a/DEBIAN/files/lx-office-erp.cherokee b/DEBIAN/files/lx-office-erp.cherokee deleted file mode 100644 index 6ea1e95be..000000000 --- a/DEBIAN/files/lx-office-erp.cherokee +++ /dev/null @@ -1,25 +0,0 @@ -## -## Virtual server for lx-office-erp -## -Directory /lx-office-erp { - Handler common - DocumentRoot /usr/lib/lx-office-erp/ -} -Directory /lx-office-erp/image { - DocumentRoot /usr/share/lx-office-erp/ -} -Directory /lx-office-erp/css{ - DocumentRoot /var/lib/lx-office-erp/css -} -Directory /lx-office-erp/templates{ - DocumentRoot /var/lib/lx-office-erp/templates -} -Directory /lx-office-erp/users{ - DocumentRoot /var/lib/lx-office-erp/users -} -Directory /lx-office-erp/webdav{ - DocumentRoot /var/lib/lx-office-erp/webdav -} -Directory /lx-office-erp/spool{ - DocumentRoot /var/lib/lx-office-erp/spool -} diff --git a/DEBIAN/files/lx-office-erp.cherokee.handler b/DEBIAN/files/lx-office-erp.cherokee.handler deleted file mode 100644 index c932e3c12..000000000 --- a/DEBIAN/files/lx-office-erp.cherokee.handler +++ /dev/null @@ -1,3 +0,0 @@ -Extension pl { - Handler cgi -} diff --git a/DEBIAN/mk_erp_deb.sh b/DEBIAN/mk_erp_deb.sh index 60fe00ef7..4fb7c008e 100755 --- a/DEBIAN/mk_erp_deb.sh +++ b/DEBIAN/mk_erp_deb.sh @@ -4,10 +4,10 @@ NR="0" #hier wurde das Git-Paket entpakt: -SRC=/tmp/deb_test/unstable +SRC=/tmp/lx-office-erp #hier wird das Debian-Paket gebaut: -DST=/tmp/deb_test/package +DST=/tmp/package ################################################ @@ -17,70 +17,13 @@ DST=/tmp/deb_test/package VER=`cat VERSION` DEST=$DST/lx-office-erp_$VER-$NR-all -FILES=' -usr/lib/lx-office-erp/ -usr/share/lx-office-erp/ -usr/share/doc/lx-office-erp/ -var/lib/lx-office-erp/spool/ -var/lib/lx-office-erp/users/ -var/lib/lx-office-erp/css/ -var/lib/lx-office-erp/xslt/ -var/lib/lx-office-erp/templates/ -var/lib/lx-office-erp/webdav/lieferantenbestellungen/ -var/lib/lx-office-erp/webdav/anfragen/ -var/lib/lx-office-erp/webdav/gutschriften/ -var/lib/lx-office-erp/webdav/einkaufsrechnungen/ -var/lib/lx-office-erp/webdav/rechnungen/ -var/lib/lx-office-erp/webdav/bestellungen/ -var/lib/lx-office-erp/webdav/angebote/ -usr/lib/lx-office-erp/ -usr/share/lx-office-erp/ -usr/share/doc/lx-office-erp/ -usr/share/man/man1/:lx-office-erp.1.gz -etc/lx-office-erp/:lx-office-erp.cherokee.handler -etc/lx-office-erp/:lx-office-erp.apache2.conf -etc/lx-office-erp/:lx-office-erp.cherokee -usr/bin/:lx-office-erp -' - -for filespec in $FILES; do - set - `echo $filespec | sed -e 's/:/ /g'` - dir=$1 - file=$2 - mkdir -p $SRC/DEBIAN/$dir - if [ -f $SRC/DEBIAN/files/$file ]; then - cp $SRC/DEBIAN/files/$file $SRC/DEBIAN/$dir/$file - else - echo '1' > $SRC/DEBIAN/$dir/.dummy - fi -done - -SYMLINKS=' -css:/var/lib/lx-office-erp/css -doc:/usr/share/doc/lx-office-erp/ -image:/usr/share/lx-office-erp -spool:/var/lib/lx-office-erp/spool -templates:/var/lib/lx-office-erp/templates -users:/var/lib/lx-office-erp/users/ -webdav:/var/lib/lx-office-erp/webdav -xslt:/var/lib/lx-office-erp/xslt -' - -for symspec in $SYMLINKS; do - set - `echo $symspec | sed -e 's/:/ /g'` - src=$1 - tar=$2 - - ln -s $tar $SRC/DEBIAN/usr/lib/lx-office-erp/$src -done -#fertig mkdir -p $DEST cd $DEST #Struktur anlegen: -cp -a $SRC/DEBIAN/* . -rm ./mk*.sh +cp -a $SRC/DEBIAN/DEBIAN . +tar xzf $SRC/DEBIAN/struktur.tgz #Dateien kopieren: #aber keine fertigen Konfigurationen, nur *.default @@ -97,6 +40,7 @@ cp -a $SRC/*.pl usr/lib/lx-office-erp cp $SRC/VERSION usr/lib/lx-office-erp cp $SRC/index.html usr/lib/lx-office-erp cp $SRC/config/lx-erp.conf etc/lx-office-erp/lx-erp.conf.default +cp $SRC/config/console.conf.default etc/lx-office-erp/ cp $SRC/config/authentication.pl.default etc/lx-office-erp/ cp $SRC/menu.ini usr/lib/lx-office-erp/menu.default cp -a $SRC/css var/lib/lx-office-erp diff --git a/DEBIAN/struktur.tgz b/DEBIAN/struktur.tgz new file mode 100644 index 000000000..a1b01c240 Binary files /dev/null and b/DEBIAN/struktur.tgz differ diff --git a/scripts/inst_postgres.sh b/scripts/inst_postgres.sh index 5fe0d71c6..db7b3129e 100755 --- a/scripts/inst_postgres.sh +++ b/scripts/inst_postgres.sh @@ -18,12 +18,24 @@ writeln 2 1 1. plpgsql.so suchen PLPGSQL="" #Datei plpgsql.so suchen -#Mit Paketmanager (RPM oder APT) suchen -#PLPGSQL=`dpkg -L postgresql | grep plpgsql.so` +POSTGRESQL=`dpkg -l | grep -E "postgresql-[0-9]" | cut -d" " -f3 | sort -r | head -1 -` + +#Mit Paketmanager (Apt) suchen +if [ "$POSTGRESQL#" == "#" ]; then + writeln 1 1 $FEHLER + writeln 2 1 Keine PostgreSQL mit Paketmanager installiert + writeln 3 1 Datenbank bitte manuell einrichten. + exit 0 +else + PLPGSQL=`dpkg -L postgresql-8.3 | grep plpgsql.so` +fi + +#Mit Paketmanager (RPM) suchen ? #PLPGSQL=`rpm -q --list postgres | grep plpgsql.so` if [ "$PLPGSQL#" == "#" ]; then #Probleme mit Paketmanager, dann zunaechst mit locate, geht schneller + updatedb writeln 3 3 --locate tmp=`locate plpgsql.so 2>/dev/null` PLPGSQL=`echo $tmp | cut -d " " -f 1` @@ -56,23 +68,16 @@ if [ $cnt -eq 0 ]; then tput rmso exit 1 fi -v7=`su postgres -c "echo 'select version()' | psql template1 2>/dev/null | grep -E "[Ss][Qq][Ll][[:space:]]+7\.[0-9]\.[0-9]" | wc -l"` -v8=`su postgres -c "echo 'select version()' | psql template1 2>/dev/null | grep -E "[Ss][Qq][Ll][[:space:]]+8\.[0-9]\.[0-9]" | wc -l"` -#cnt=`echo $v7 + $v8 | bc -l` +v8=`su postgres -c "echo 'select version()' | psql template1 2>/dev/null | grep -E "[Ss][Qq][Ll][[:space:]]+8\.[2-9]\.[0-9]" | wc -l"` if [ $v8 -eq 0 ]; then - if [ $v7 -eq 0 ]; then - tput bel - tput bold - echo User postgres konnte die Datenbank nicht ansprechen - tput rmso - exit 1; - else - tput clear - writeln 1 1 Datenbank Version 7x konnte erreicht werden. - fi + tput bel + tput bold + echo User postgres konnte die Datenbank 8.2.x - 8.9.x nicht ansprechen + tput rmso + exit 1; else tput clear - writeln 1 1 Datenbank Version 8x konnte erreicht werden. + writeln 1 1 Datenbank Version 8.2.x - 8.9.x konnte erreicht werden. fi echo "CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler" > lxdbinst.sql @@ -108,7 +113,7 @@ writeln 11 1 Datenbank fuer Lx-Office vorbereitet writeln 12 1 Datenbankberechtigung einrichten #wo ist die pg_hba.conf writeln 13 3 --find erst /etc dann /var/lib -tmp=`find /etc -name pg_hba.conf -type f` +tmp=`find /etc/postgresql -name pg_hba.conf -type f` [ "$tmp#" == "#" ] && tmp=`find /var/lib -name pg_hba.conf -type f` PGHBA=`echo $tmp | cut -d " " -f 1` @@ -152,26 +157,16 @@ if ! [ -f $CONFDIR/postgresql.conf ]; then fi mv $CONFDIR/postgresql.conf $CONFDIR/postgresql.conf.org -if ! [ $v7 -eq 0 ]; then - #Nur bei der V7.x: tcpip_socket = true - sed 's/^.*tcpip_socket.*/tcpip_socket = true/i' $CONFDIR/postgresql.conf.org > $CONFDIR/postgresql.conf - cnt=`grep tcpip_socket $CONFDIR/postgresql.conf | wc -l` - if [ $cnt -eq 0 ]; then - cp $CONFDIR/postgresql.conf.org $CONFDIR/postgresql.conf - echo "tcpip_socket = true" >> $CONFDIR/postgresql.conf - fi -else - #Bei der V8.x OID einschalten. - sed 's/^.*default_with_oids.*/default_with_oids = true/i' $CONFDIR/postgresql.conf.org > $CONFDIR/postgresql.conf - cnt=`grep default_with_oids $CONFDIR/postgresql.conf | wc -l` - if [ $cnt -eq 0 ]; then - cp $CONFDIR/postgresql.conf.org $CONFDIR/postgresql.conf - echo "default_with_oids = true" >> $CONFDIR/postgresql.conf - fi +#Bei der V8.x OID einschalten. +sed 's/^.*default_with_oids.*/default_with_oids = true/i' $CONFDIR/postgresql.conf.org > $CONFDIR/postgresql.conf +cnt=`grep default_with_oids $CONFDIR/postgresql.conf | wc -l` +if [ $cnt -eq 0 ]; then + cp $CONFDIR/postgresql.conf.org $CONFDIR/postgresql.conf + echo "default_with_oids = true" >> $CONFDIR/postgresql.conf fi -tmp=`ls /etc/init.d/postgres*` +tmp=`ls -r1 /etc/init.d/postgres*` PGSQL=`echo $tmp | cut -d " " -f 1` writeln 18 1 Datenbank neu starten diff --git a/scripts/inst_postgres_deb.sh b/scripts/inst_postgres_deb.sh index cec0b7df2..d5a313832 100755 --- a/scripts/inst_postgres_deb.sh +++ b/scripts/inst_postgres_deb.sh @@ -1,92 +1,60 @@ #!/bin/bash -#set -x - # e = exit on error set -e # x = xtrace -#set -x +set -x +FEHLER="Achtung!! Es hat ein Problem gegeben" +ERRCNT=0 source /usr/share/debconf/confmodule - -function writeln() -{ - tput cup $1 $2 # Cursor positionieren - tput el # Rest der Zeile löschen - shift 2 # Parameter für die Koordinaten entfernen - echo -n $*" " # Rest der Parameterliste ausgeben -} - -#tput clear - #Als root anmelden if [ `id -u` -gt 0 ]; then echo "Bitte als root anmelden"; exit 1; fi +POSTGRESQL=`dpkg -l | grep -E "postgresql-[0-9]" | cut -d" " -f3 | sort -r | head -1 -` -#writeln 1 1 PostgreSQL fuer Lx-Office vorbereiten -#writeln 2 1 1. plpgsql.so suchen -PLPGSQL="" #Datei plpgsql.so suchen - -#Mit Paketmanager (RPM oder APT) suchen -#PLPGSQL=`dpkg -L postgresql | grep plpgsql.so` -#PLPGSQL=`rpm -q --list postgres | grep plpgsql.so` +#Mit Paketmanager suchen +if [ "$POSTGRESQL#" == "#" ]; then + echo $FEHLER + echo Keine PostgreSQL mit Paketmanager installiert + echo Datenbank bitte manuell einrichten. + exit 0 +else + PLPGSQL=`dpkg -L postgresql-8.3 | grep plpgsql.so` +fi if [ "$PLPGSQL#" == "#" ]; then - #Probleme mit Paketmanager, dann zunaechst mit locate, geht schneller -# writeln 3 3 --locate - tmp=`locate plpgsql.so 2>/dev/null` - PLPGSQL=`echo $tmp | cut -d " " -f 1` + #Probleme mit Paketmanager, dann zunaechst mit locate, geht schneller + updatedb + tmp=`locate plpgsql.so 2>/dev/null` + PLPGSQL=`echo $tmp | cut -d " " -f 1` fi if [ "$PLPGSQL#" == "#" ]; then - #noch nicht gefunden, also mit find suchen -# writeln 3 15 --find /usr/lib - tmp=`find /usr/lib -name plpgsql.so -type f` - PLPGSQL=`echo $tmp | cut -d " " -f 1` + #noch nicht gefunden, also mit find suchen + tmp=`find /usr/lib -name plpgsql.so -type f` + PLPGSQL=`echo $tmp | cut -d " " -f 1` fi if [ "$PLPGSQL#" == "#" ]; then - while :; do -# writeln 4 1 'plpgsql.so' nicht gefunden. -# tput bold -# writeln 5 1 "Bitte den Pfad eingeben: " -# tput rmso -# read PLPGSQL - [ "$PLPGSQL#" != "#" ] && [ -f $PLPGSQL ] && break - # tput bel - done + echo $FEHLER + echo 'plpgsql.so' nicht gefunden. + echo Datenbank manuell einrichten. + exit 0 fi -#writeln 6 1 ok. 'plpgsql.so' gefunden #Kann der User postgres die db erreichen cnt=`ps aux | grep postgres | wc -l` if [ $cnt -eq 0 ]; then -# tput bel -# tput bold - echo Die postgreSQL-Datebbank ist nicht gestartet! -# tput rmso - exit 1 + echo $FEHLER + echo Die postgreSQL-Datebbank ist nicht gestartet! + echo Datenbank manuell einrichten. + exit 0 fi -v7=`su postgres -c "echo 'select version()' | psql template1 2>/dev/null | grep -E "[Ss][Qq][Ll][[:space:]]+7\.[0-9]\.[0-9]" | wc -l"` -v8=`su postgres -c "echo 'select version()' | psql template1 2>/dev/null | grep -E "[Ss][Qq][Ll][[:space:]]+8\.[0-9]\.[0-9]" | wc -l"` -#cnt=`echo $v7 + $v8 | bc -l` + +v8=`su postgres -c "echo 'select version()' | psql template1 2>/dev/null | grep -E "[Ss][Qq][Ll][[:space:]]+8\.[2-9]\.[0-9]" | wc -l"` if [ $v8 -eq 0 ]; then - if [ $v7 -eq 0 ]; then -# tput bel -# tput bold - echo User postgres konnte die Datenbank nicht ansprechen -# tput rmso - exit 1; - else - # do nothing - echo "" - -# tput clear -# writeln 1 1 Datenbank Version 7x konnte erreicht werden. - fi -else - # do nothing - echo "" -# tput clear -# writeln 1 1 Datenbank Version 8x konnte erreicht werden. + echo $FEHLER + echo Datenbank Version 8x konnte erreicht werden. + exit 0 fi echo "CREATE FUNCTION plpgsql_call_handler() RETURNS language_handler" > lxdbinst.sql @@ -95,26 +63,10 @@ echo "LANGUAGE c;" >> lxdbinst.sql echo "CREATE PROCEDURAL LANGUAGE plpgsql HANDLER plpgsql_call_handler;" >> lxdbinst.sql #writeln 2 1 Datenbankbenutzer einrichten -#tput bold -#writeln 3 1 "Bitte den Datenbank-Benutzernamen (Kleinbuchstaben) eingeben [lxoffice]: " -#tput rmso -#read LXOUSER -#if [ "$LXOUSER#" == "#" ]; then LXOUSER="lxoffice"; fi -#while :; do -# tput bold -# writeln 4 1 "Bitte ein Kennwort eingeben : " -# tput rmso -# read USRPWD - if ! [ "$USRPWD#" == "#" ]; then break; fi -# tput bel -#done; - LXOUSER="lxoffice" - db_get lx-office-erp/lx-office-erp-user-postgresql-password USRPWD="$RET" - echo "CREATE USER $LXOUSER with CREATEDB ;" >> lxdbinst.sql echo "ALTER USER $LXOUSER PASSWORD '$USRPWD';" >> lxdbinst.sql echo "UPDATE pg_language SET lanpltrusted = true WHERE lanname = 'plpgsql';" >> lxdbinst.sql @@ -123,83 +75,57 @@ su postgres -c "psql template1 < lxdbinst.sql" echo "Fehlermeldungen die 'already exists' enthalten koennen ignoriert werden" -#writeln 11 1 Datenbank fuer Lx-Office vorbereitet - #writeln 12 1 Datenbankberechtigung einrichten -#wo ist die pg_hba.conf -#writeln 13 3 --find erst /etc dann /var/lib -tmp=`find /etc -name pg_hba.conf -type f` -[ "$tmp#" == "#" ] && tmp=`find /var/lib -name pg_hba.conf -type f` -PGHBA=`echo $tmp | cut -d " " -f 1` +PGHBA=`find /etc/postgresql -name pg_hba.conf -type f | sort -r | head -1 -` +if [ "$PGHBA#" == "#" ] ; then + PGHBA=`find /var/lib -name pg_hba.conf -type f | sort -r | head -1 -` +fi if [ "$PGHBA#" == "#" ]; then - while :; do -# writeln 14 1 'pg_hba.conf' nicht gefunden. -# tput bold -# writeln 15 1 "Bitte den Pfad eingeben: " -# tput rmso -# read PGHBA - [ "$PGHBA#" != "#" ] && [ -f $PGHBA ] && break - # tput bel - done + echo $FEHLER + echo 'pg_hba.conf' nicht gefunden. + echo "Berechtigungen bitte selber einrichten" + ERRCNT=1 fi -#writeln 16 1 ok. 'pg_hba.conf' gefunden cnt=`grep $LXOUSER $PGHBA | wc -l ` if [ $cnt -eq 0 ]; then - mv $PGHBA $PGHBA.org - echo "local all $LXOUSER password" > $PGHBA - echo "host all $LXOUSER 127.0.0.1 255.255.255.255 password" >> $PGHBA - cat $PGHBA.org >> $PGHBA + mv $PGHBA $PGHBA.org + echo "local all $LXOUSER password" > $PGHBA + echo "host all $LXOUSER 127.0.0.1 255.255.255.255 password" >> $PGHBA + cat $PGHBA.org >> $PGHBA fi CONFDIR=`dirname $PGHBA` #postgresql.conf anpassen, liegt vermutlich im gleichen Verzeichnis wie pg_hba.conf if ! [ -f $CONFDIR/postgresql.conf ]; then - #doch nicht da, dann fragen - while :; do -# writeln 13 1 'postgresql.conf' nicht gefunden. -# tput bold -# writeln 14 1 "Bitte den Pfad eingeben: " -# tput rmso -# read PGCONF - [ "$PGCONF#" != "#" ] && [ -f $PGCONF ] && break - # tput bel - done - CONFDIR=`dirname $PGCONF` + echo $FEHLER + echo 'postgresql.conf' nicht gefunden. + echo PostgreSQL selber konfigurieren + ERRCNT=1 fi mv $CONFDIR/postgresql.conf $CONFDIR/postgresql.conf.org -if ! [ $v7 -eq 0 ]; then - #Nur bei der V7.x: tcpip_socket = true - sed 's/^.*tcpip_socket.*/tcpip_socket = true/i' $CONFDIR/postgresql.conf.org > $CONFDIR/postgresql.conf - cnt=`grep tcpip_socket $CONFDIR/postgresql.conf | wc -l` - if [ $cnt -eq 0 ]; then - cp $CONFDIR/postgresql.conf.org $CONFDIR/postgresql.conf - echo "tcpip_socket = true" >> $CONFDIR/postgresql.conf - fi -else - #Bei der V8.x OID einschalten. - sed 's/^.*default_with_oids.*/default_with_oids = true/i' $CONFDIR/postgresql.conf.org > $CONFDIR/postgresql.conf - cnt=`grep default_with_oids $CONFDIR/postgresql.conf | wc -l` - if [ $cnt -eq 0 ]; then - cp $CONFDIR/postgresql.conf.org $CONFDIR/postgresql.conf - echo "default_with_oids = true" >> $CONFDIR/postgresql.conf - fi +#Bei der V8.x OID einschalten. +sed 's/^.*default_with_oids.*/default_with_oids = true/i' $CONFDIR/postgresql.conf.org > $CONFDIR/postgresql.conf +cnt=`grep default_with_oids $CONFDIR/postgresql.conf | wc -l` +if [ $cnt -eq 0 ]; then + cp $CONFDIR/postgresql.conf.org $CONFDIR/postgresql.conf + echo "default_with_oids = true" >> $CONFDIR/postgresql.conf fi -tmp=`ls /etc/init.d/postgres*` -PGSQL=`echo $tmp | cut -d " " -f 1` +tmp=`ls -r1 /etc/init.d/postgres* | head -1 -` #writeln 18 1 Datenbank neu starten $PGSQL reload -#tput bold -#tput smso -#writeln 20 12 ok. Das sollte es gewesen sein. -#tput rmso -#tput rmso -echo +if [ $ERRCNT -gt 0 ]; then + echo $FEHLER + echo Das betrifft aber nicht die Lx-Office Installation + echo sondern die Konfiguration der Datenbank. + echo $POSTGRESQL , $PGHBA , $CONFDIR/postgresql.conf ?? + sleep 10 +fi