gnumed-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnumed-devel] bootstrapping database problem


From: Florian Hubold
Subject: Re: [Gnumed-devel] bootstrapping database problem
Date: Thu, 17 Jul 2008 09:40:26 +0200
User-agent: Thunderbird 2.0.0.14 (X11/20080629)

Sebastian Hilbert schrieb:
Hi Florian,

Please send me your spec file. If it work fine for the buildservice I will use this an a replacement and we wil put this into CVS

Hey Sebastian, this is my current spec for gnumed-server for mandriva 2008.1.
You can put it in CVS, but i have to investigate about that issue with the
non-existent ph_hba.conf and how it should be created the clean way.
This needs to be sorted out with other distributions, also.
Then you can have the resulting "final" packages or the specs for productive use.

%define name    gnumed-server
%define oname  GNUmed-server
%define summary The GNUmed backend server
%define version v8

%define pg_hba   /var/lib/pgsql/data/pg_hba.conf
%define pg_ident /var/lib/pgsql/data/pg_ident.conf

Summary:        %summary
Name:           %name
Version:        %version
Release:        %mkrel 7
License:        GPL
Group:          System/Servers
Source:         http://www.gnumed.de/downloads/server/v8/%{oname}.%{version}.tgz
Patch0:         bootstrap-latest.sh.patch
Patch1:         bootstrap_gm_db_system.py.patch
BuildRoot:      %_tmppath/%name-%version-buildroot
URL:            http://wiki.gnumed.de/
Requires:       sudo
Requires:       python
Requires:       python-psycopg2
Requires:       postgresql-plpython
Requires:       postgresql-plpgsql

%description
The GNUmed project builds an open source Electronic Medical Record. It is 
developed by a handful of medical doctors and programmers from all over the 
world. It can be useful to anyone documenting the health of patients, including 
but not limited to doctors, physical therapists, occupational therapists, ...

%prep
%setup -q -n GNUmed-%{version}
#%patch0 -p1
%patch1 -p1

%install
rm -rf %buildroot
mkdir -p %buildroot%{_libdir}/%{name}/server
cp -R * %buildroot/%{_libdir}/%{name}
echo "%{version}" > %buildroot/%{_libdir}/%{name}/server/version.txt

%clean
rm -rf %buildroot

%post
if [ $1 = 1 ]; then
    # initial install, let's make sure that postgresql is running
    set -x
    /sbin/chkconfig postgresql on
    service postgresql restart
    # &> /dev/null ||:
    
    # configure the pg_hba.conf file for postgresql Host Based Authentication
    #grep -qP 'local\s+template1\s+postgres\s+ident\s+postgres-alikes' %pg_hba
    #if [ $? -eq 1  ]; then
    #    echo "local template1 postgres ident postgres-alikes" >> %pg_hba
    #fi
    #grep -qP 'local\s+gnumed_v7\s+postgres\s+ident\s+postgres-alikes' %pg_hba
    #if [ $? -eq 1  ]; then
    #    echo "local gnumed_v7 postgres ident postgres-alikes" >> %pg_hba
    #fi
    #grep -qP 'local\s+gnumed_v8\s+postgres\s+ident\s+postgres-alikes' %pg_hba
    #if [ $? -eq 1  ]; then
    #    echo "local gnumed_v8 postgres ident postgres-alikes" >> %pg_hba
    #fi
    #grep -qP 'local\s+all\s+postgres\s+ident\s+sameuser' %pg_hba
    #if [ $? -eq 1  ]; then
    #    echo "local all postgres ident sameuser" >> %pg_hba
    #fi
    #grep -qP 'local\s+template1\s+gm-dbo\s+ident\s+gm-dbo-alikes' %pg_hba
    #if [ $? -eq 1  ]; then
    #    echo "local template1 gm-dbo ident gm-dbo-alikes" >> %pg_hba
    #fi
    set -x
    cp /usr/share/pgsql/pg_hba.conf.sample /var/lib/pgsql/data/ph_hba.conf
    grep -qP 'local\s+samegroup\s+\+gm-logins\s+md5' %pg_hba
    if [ $? -eq 1  ]; then
        echo "local samegroup +gm-logins md5" >> %pg_hba
    fi
    
    #configure the pg_ident.conf file
    #grep -qP 'gm-dbo-alikes\s+gmadm\s+gm-dbo' %pg_ident
    #if [ $? -eq 1  ]; then
    #    echo "gm-dbo-alikes gmadm gm-dbo" >> %pg_ident
    #fi
    #grep -qP 'postgres-alikes\s+postgres\s+postgres' %pg_ident
    #if [ $? -eq 1  ]; then
    #    echo "postgres-alikes postgres postgres" >> %pg_ident
    #fi
    #grep -qP 'postgres-alikes\s+gmadm\s+postgres' %pg_ident
    #if [ $? -eq 1  ]; then
    #    echo "postgres-alikes gmadm postgres" >> %pg_ident
    #fi
    # signal postgres that configuration has changed
    set -x
    sudo -u postgres pg_ctl -D `dirname %pg_ident` reload &
    # > /dev/null ||:
    # now let's bootstrap the database
    cd %{_libdir}/%{name}/server/bootstrap
    # export PYTHONPATH=%{_libdir}/%{oname}
    ./bootstrap-latest.sh
fi
if [ $1 = 2 ]; then
    # upgrade
    # figure out which version is installed by reading 
%{_libdir}/%{oname}/version.txt and save this in $prev
    # do the following 
    #       upgrade-db.sh $prev $prev+1
    # until $prev+1 equals $version
    echo "Upgrading is not implemented yet (nothing to upgrade to),"
    echo "yet somehow when you ran this - you just lost all of your data!"
fi


%files
%defattr(-,root,root,-)
%{_libdir}/%{name}

%changelog
* Wed Jul 16 2008 Doktor5000 <address@hidden> v8-7mud2008.1
- add missing dependency on postgresql-plpgsql
- clean up postgresql setup
- remove unneeded stuff

* Tue Jul 15 2008 Doktor5000 <address@hidden> v8-6mud2008.1
- completely redo directory layout again, keep original structure from tarball

* Mon Jul 14 2008 Doktor5000 <address@hidden> v8-5mud2008.1
- completely redo directory layout
- really fix bootstrapping of the database

* Mon Jul 14 2008 Doktor5000 <address@hidden> v8-4mud2008.1
- fix directory layout
- fix bootstrapping of the database

* Fri Jul 11 2008 Doktor5000 <address@hidden> v8-3mud2008.1
- fix order of %%Requires
- fix location of PostgreSQL config file
- make scripts even more verbose, displays errors

* Thu Apr 10 2008 Doktor5000 <address@hidden> v8-2mud2008.1
- make scripts more verbose

* Thu Apr 10 2008 Doktor5000 <address@hidden> v8-1mud2008.1
- rebuild for Mandrivalinux 2008.1

* Sat Jan 26 2007 Paul Grinberg <address@hidden> v8-2pclos2007
- initial version for PCLinuxOS 2007

reply via email to

[Prev in Thread] Current Thread [Next in Thread]