OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Thomas Lotterer
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src openpkg-web          Date:   23-Jul-2003 22:41:49
  Branch: HEAD                             Handle: 2003072321414702

  Modified files:
    openpkg-src/postgresql  postgresql.spec rc.postgresql
    openpkg-web             news.txt

  Log:
    PR#202 run-time check and related issues

  Summary:
    Revision    Changes     Path
    1.72        +38 -38     openpkg-src/postgresql/postgresql.spec
    1.13        +10 -4      openpkg-src/postgresql/rc.postgresql
    1.5773      +1  -0      openpkg-web/news.txt
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/postgresql/postgresql.spec
  ============================================================================
  $ cvs diff -u -r1.71 -r1.72 postgresql.spec
  --- openpkg-src/postgresql/postgresql.spec    22 Jul 2003 08:11:02 -0000      1.71
  +++ openpkg-src/postgresql/postgresql.spec    23 Jul 2003 20:41:49 -0000      1.72
  @@ -40,7 +40,7 @@
   Group:        Database
   License:      GPL
   Version:      %{V_postgresql}
  -Release:      20030722
  +Release:      20030723
   
   #   package options
   %option       with_cxx      no
  @@ -319,38 +319,33 @@
       rm -rf $RPM_BUILD_ROOT
   
   %pre
  -    if [ $1 -gt 1 ]; then
  -        #   upgrading of installation
  -        if [ -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION -a \
  -             -f $RPM_INSTALL_PREFIX/bin/pg_migrate ]; then
  -            #   database migration dumping hint
  -            v_old_all=`cat $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION`
  -            v_old_maj=`echo "$v_old_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'`
  -            v_new_all="%{V_postgresql}"
  -            v_new_maj=`echo "$v_new_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'`
  -            if [ ".$v_old_maj" != ".$v_new_maj" ]; then
  -               if [ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2 -a 
".$PG_MIGRATE" != .ignore ]; then
  -                    ( echo "You are upgrading from PostgreSQL $v_old_all to 
PostgresSQL $v_new_all,"
  -                      echo "which is a major version change. We expect a database 
incompatibility,"
  -                      echo "so we strongly recommend that you backup your existing 
database"
  -                      echo "($RPM_INSTALL_PREFIX/var/postgresql/db/) first by 
running:"
  -                      echo "    \$ $RPM_INSTALL_PREFIX/bin/pg_migrate dump"
  -                      echo "Alternatively, if you want force this package to be 
installed without"
  -                      echo "performing a database dump, run the following command 
before upgrading:"
  -                      echo "    \$ PG_MIGRATE=ignore; export PG_MIGRATE"
  -                    ) | %{l_rpmtool} msg -b -t error
  -                    exit 1
  -                fi
  +    #   before upgrade, check migration dump, save status and stop service
  +    [ $1 -eq 2 ] || exit 0
  +    if [ -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION -a \
  +         -f $RPM_INSTALL_PREFIX/bin/pg_migrate ]; then
  +        #   database migration dumping hint
  +        v_old_all=`cat $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION`
  +        v_old_maj=`echo "$v_old_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'`
  +        v_new_all="%{V_postgresql}"
  +        v_new_maj=`echo "$v_new_all" | sed -e 's/^\([0-9]*\.[0-9]*\).*/\1/'`
  +        if [ ".$v_old_maj" != ".$v_new_maj" ]; then
  +           if [ ! -f $RPM_INSTALL_PREFIX/var/postgresql/db.dump.sql.bz2 -a 
".$PG_MIGRATE" != .ignore ]; then
  +                ( echo "You are upgrading from PostgreSQL $v_old_all to PostgresSQL 
$v_new_all,"
  +                  echo "which is a major version change. We expect a database 
incompatibility,"
  +                  echo "so we strongly recommend that you backup your existing 
database"
  +                  echo "($RPM_INSTALL_PREFIX/var/postgresql/db/) first by running:"
  +                  echo "    \$ $RPM_INSTALL_PREFIX/bin/pg_migrate dump"
  +                  echo "Alternatively, if you want force this package to be 
installed without"
  +                  echo "performing a database dump, run the following command 
before upgrading:"
  +                  echo "    \$ PG_MIGRATE=ignore; export PG_MIGRATE"
  +                ) | %{l_rpmtool} msg -b -t error
  +                exit 1
               fi
           fi
  -        rm -f $RPM_INSTALL_PREFIX/var/posgresql/RESTART >/dev/null 2>&1 || true
  -        if [ ".`$l_prefix/etc/rc postgresql status 2>&1 | grep 'is running'`" != . 
]; then
  -            echo "Shutting down currently running database engine." | %{l_rpmtool} 
msg -b -t notice
  -            $RPM_INSTALL_PREFIX/etc/rc postgresql stop
  -            touch $RPM_INSTALL_PREFIX/var/posgresql/RESTART
  -            sleep 4
  -        fi
       fi
  +    eval `%{l_rc} postgresql status 2>/dev/null | tee %{l_tmpfile}`
  +    %{l_rc} postgresql stop 2>/dev/null
  +    exit 0
   
   %post
       if [ $1 -eq 1 ]; then
  @@ -401,14 +396,11 @@
             echo "Threading       = 2"
           ) | $RPM_INSTALL_PREFIX/bin/odbcinst -i -d -r
   %endif
  -    elif [ $1 -gt 1 ]; then
  -        #   upgrading of installation
  -        if [ -f $RPM_INSTALL_PREFIX/var/posgresql/RESTART ]; then
  -            echo "Starting database engine again." | %{l_rpmtool} msg -b -t notice
  -            $RPM_INSTALL_PREFIX/etc/rc postgresql start
  -            rm -f $RPM_INSTALL_PREFIX/var/posgresql/RESTART >/dev/null 2>&1 || true
  -            sleep 2
  -        fi
  +    fi
  +    if [ $1 -eq 2 ]; then
  +        #   after upgrade, restore status
  +        { eval `cat %{l_tmpfile}`; rm -f %{l_tmpfile}; true; } >/dev/null 2>&1
  +        [ ".$postgresql_active" = .yes ] && %{l_rc} postgresql start
           if [ -f $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION -a ".$PG_MIGRATE" 
!= .ignore ]; then
               #   database migration restoring hint
               v_old_all=`cat $RPM_INSTALL_PREFIX/var/postgresql/db/PG_VERSION`
  @@ -425,4 +417,12 @@
               fi
           fi
       fi
  +    exit 0
  +
  +%preun
  +    #   before erase, stop service and remove log files
  +    [ $1 -eq 0 ] || exit 0
  +    %{l_rc} postgresql stop 2>/dev/null
  +    rm -f $RPM_INSTALL_PREFIX/var/postgresql/run/* >/dev/null 2>&1 || true
  +    exit 0
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/postgresql/rc.postgresql
  ============================================================================
  $ cvs diff -u -r1.12 -r1.13 rc.postgresql
  --- openpkg-src/postgresql/rc.postgresql      22 Jul 2003 08:11:02 -0000      1.12
  +++ openpkg-src/postgresql/rc.postgresql      23 Jul 2003 20:41:49 -0000      1.13
  @@ -8,9 +8,8 @@
       postgresql_flags=""
       postgresql_datadir="@l_prefix@/var/postgresql/db"
       postgresql_shut_mode="smart"
  -    postgresql_socket_inet="localhost"
  +    postgresql_socket_inet="127.0.0.1"
       postgresql_socket_unix="@l_prefix@/var/postgresql/run/"
  -    postgresql_log_file="@l_prefix@/var/postgresql/run/postmaster.log"
       postgresql_log_prolog="true"
       postgresql_log_epilog="true"
       postgresql_log_numfiles="10"
  @@ -20,6 +19,7 @@
   %common
       postgresql_opts="-i -h $postgresql_socket_inet -k $postgresql_socket_unix"
       postgresql_opts="$postgresql_opts $postgresql_flags"
  +    postgresql_log_file="@l_prefix@/var/postgresql/run/postgresql.log"
   
   %status -u @l_rusr@ -o
       postgresql_usable="unknown"
  @@ -32,26 +32,32 @@
   
   %start -p 400 -u @l_rusr@
       rcService postgresql enable yes || exit 0
  +    rcService postgresql active yes && exit 0
       @l_prefix@/bin/pg_ctl start -l $postgresql_log_file -D $postgresql_datadir -o 
"$postgresql_opts"
   
   %stop -p 400 -u @l_rusr@
       rcService postgresql enable yes || exit 0
  +    rcService postgresql active no  && exit 0
       @l_prefix@/bin/pg_ctl stop -l $postgresql_log_file -D $postgresql_datadir -m 
$postgresql_shut_mode
   
   %restart -p 400 -u @l_rusr@
       rcService postgresql enable yes || exit 0
  +    rcService postgresql active no  && exit 0
       @l_prefix@/bin/pg_ctl restart -l $postgresql_log_file -D $postgresql_datadir -o 
"$postgresql_opts" -m $postgresql_shut_mode
   
   %reload -p 400 -u @l_rusr@
       rcService postgresql enable yes || exit 0
  +    rcService postgresql active no  && exit 0
       @l_prefix@/bin/pg_ctl reload -D $postgresql_datadir
   
   %daily -u @l_rusr@
       rcService postgresql enable yes || exit 0
  +
  +    #   rotate logfile
       shtool rotate -f \
           -n ${postgresql_log_numfiles} -s ${postgresql_log_minsize} -d \
  -        -z ${postgresql_log_complevel} -m 644 \
  +        -z ${postgresql_log_complevel} -m 600 -o @l_rusr@ -g @l_rgrp@ \
           -P "$postgresql_log_prolog" \
  -        -E "@l_prefix@/bin/pg_ctl reload -D $postgresql_datadir; 
$postgresql_log_epilog" \
  +        -E "$postgresql_log_epilog && rc postgresql reload" \
           $postgresql_log_file
   
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-web/news.txt
  ============================================================================
  $ cvs diff -u -r1.5772 -r1.5773 news.txt
  --- openpkg-web/news.txt      23 Jul 2003 20:27:08 -0000      1.5772
  +++ openpkg-web/news.txt      23 Jul 2003 20:41:47 -0000      1.5773
  @@ -1,3 +1,4 @@
  +23-Jul-2003: Upgraded package: P<postgresql-7.3.3-20030723>
   23-Jul-2003: Upgraded package: P<mysql-4.0.14-20030723>
   23-Jul-2003: Upgraded package: P<qt-3.2.0-20030723>
   23-Jul-2003: Upgraded package: P<m4-1.4o-20030723>
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to