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

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /v/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   09-May-2008 11:43:44
  Branch: HEAD                             Handle: 2008050910434400

  Modified files:
    openpkg-src/drupal      drupal-setup.sh

  Log:
    more comments; use correct database for restore; automatically
    shutdown and restart Drupal on restore

  Summary:
    Revision    Changes     Path
    1.20        +42 -6      openpkg-src/drupal/drupal-setup.sh
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/drupal/drupal-setup.sh
  ============================================================================
  $ cvs diff -u -r1.19 -r1.20 drupal-setup.sh
  --- openpkg-src/drupal/drupal-setup.sh        9 May 2008 09:05:05 -0000       
1.19
  +++ openpkg-src/drupal/drupal-setup.sh        9 May 2008 09:43:44 -0000       
1.20
  @@ -43,7 +43,10 @@
   shift
   case "$cmd" in
       install )
  -        #   create the database
  +        ##
  +        ##  create the database
  +        ##
  +
           if [ $# -gt 0 ]; then
               db_dir="$1"
               shift
  @@ -67,8 +70,12 @@
               chmod 777 @l_prefix@/share/drupal/sites/default
           fi
           ;;
  +
       uninstall )
  -        #   remove the database
  +        ##
  +        ##  remove the database
  +        ##
  +
           if [ ".$db_type" = .mysql ]; then
               ( echo "DROP DATABASE $db_name;"
               ) | @l_prefix@/bin/mysql --user="$db_suser" 
--password="$db_spass" "$db_sname"
  @@ -84,11 +91,18 @@
               rm -f @l_prefix@/share/drupal/sites/default/settings.php
           fi
           ;;
  +
       backup )
  -        #   backup the database
  +        ##
  +        ##  backup the database
  +        ##
  +
  +        #   determine dumpfile
           if [ $# -gt 0 ]; then
  +            #   manually managed dumpfile
               dumpfile="$1"
           else
  +            #   automatically managed (rotated) dumpfile
               rm -f $db_dump/drupal-dump-9.sql.gz >/dev/null 2>&1 || true
               i=8
               while [ $i -ge 0 ]; do
  @@ -99,6 +113,8 @@
               done
               dumpfile="$db_dump/drupal-dump-0.sql.bz2"
           fi
  +
  +        #   dump database content to dumpfile (compressed plain SQL format)
           if [ ".$db_type" = .mysql ]; then
               @l_prefix@/bin/mysqldump --user="$db_suser" 
--password="$db_spass" "$db_name" | \
               @l_prefix@/lib/openpkg/bzip2 -9 >$dumpfile
  @@ -107,8 +123,13 @@
               @l_prefix@/lib/openpkg/bzip2 -9 >$dumpfile
           fi
           ;;
  +
       restore )
  -        #   restore the database
  +        ##
  +        ##  restore the database
  +        ##
  +
  +        #   determine dumpfile
           if [ $# -gt 0 ]; then
               dumpfile="$1"
           else
  @@ -121,16 +142,31 @@
               echo "drupal-setup:restore:ERROR: no such dump file: $dumpfile" 
1>&2
               exit 1
           fi
  +
  +        #   optionally stop Drupal
  +        eval [EMAIL PROTECTED]@/bin/openpkg rc drupal status >/dev/null 2>&1 
|| true`
  +        if [ ".$drupal_active" = .yes ]; then
  +            @l_prefix@/bin/openpkg rc drupal stop >/dev/null 2>&1 || true
  +        fi
  +
  +        #   drop old and initialize new database
           DRUPAL_SETUP_RESTORE=1
           export DRUPAL_SETUP_RESTORE
           $prg uninstall || exit $?
           $prg install   || exit $?
  +
  +        #   restore database content from dumpfile (compressed plain SQL 
format)
           if [ ".$db_type" = .mysql ]; then
               @l_prefix@/lib/openpkg/bzip2 -d -c $dumpfile | \
  -            @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" 
"$db_sname"
  +            @l_prefix@/bin/mysql --user="$db_suser" --password="$db_spass" 
"$db_name"
           elif [ ".$db_type" = .pgsql ]; then
               @l_prefix@/lib/openpkg/bzip2 -d -c $dumpfile | \
  -            PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d 
"$db_sname" -f-
  +            PGPASSWORD="$db_spass" @l_prefix@/bin/psql -q -U "$db_suser" -d 
"$db_name" -f-
  +        fi
  +
  +        #   optionally restart Drupal
  +        if [ ".$drupal_active" = .yes ]; then
  +            @l_prefix@/bin/openpkg rc drupal start
           fi
           ;;
   esac
  @@ .
______________________________________________________________________
OpenPKG                                             http://openpkg.org
CVS Repository Commit List                     [email protected]

Reply via email to