[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gforge-commits] gforge/deb-specific install-db.sh, 1.27.2.6, 1.27.2.7
From: |
lo-lan-do |
Subject: |
[Gforge-commits] gforge/deb-specific install-db.sh, 1.27.2.6, 1.27.2.7 |
Date: |
Wed, 04 Aug 2004 14:13:44 -0500 |
Update of /cvsroot/gforge/gforge/deb-specific
In directory db.perdue.net:/tmp/cvs-serv479/deb-specific
Modified Files:
Tag: Branch_3_1
install-db.sh
Log Message:
3.1-19: Fixed database dump for transition so it doesn't fail (or do
anything) if the database doesn't exist (closes: #263349).
Index: install-db.sh
===================================================================
RCS file: /cvsroot/gforge/gforge/deb-specific/install-db.sh,v
retrieving revision 1.27.2.6
retrieving revision 1.27.2.7
diff -u -d -r1.27.2.6 -r1.27.2.7
--- install-db.sh 3 Aug 2004 13:26:06 -0000 1.27.2.6
+++ install-db.sh 4 Aug 2004 19:13:40 -0000 1.27.2.7
@@ -218,8 +218,10 @@
else
DB=$db_name
fi
+ mkdir -p $(dirname $DUMPFILE)
echo "Dumping $DB database in $DUMPFILE"
- su -s /bin/sh $DB -c /usr/lib/postgresql/bin/pg_dump $DB > $DUMPFILE
+ su -s /bin/sh $DB -c /usr/lib/postgresql/bin/pg_dump $DB > $DUMPFILE \
+ || true
;;
restore)
db_name=$(grep ^db_name= /etc/gforge/gforge.conf | cut -d= -f2-)
@@ -243,13 +245,17 @@
else
RESTFILE=/var/lib/gforge/dumps/db_dump
fi
- echo "Restoring $RESTFILE"
- su -s /bin/sh postgres -c "dropdb $db_name" || true
- su -s /bin/sh postgres -c "createdb --encoding=UNICODE $db_name" ||
true
- su -s /bin/sh postgres -c "/usr/lib/postgresql/bin/psql -f $RESTFILE
$db_name"
- perl -pi -e "s/### Next line inserted by GForge restore\n//"
/etc/postgresql/pg_hba.conf
- perl -pi -e "s/$localtrust\n//" /etc/postgresql/pg_hba.conf
- #perl -pi -e "s/host all 127.0.0.1 255.255.255.255 trust\n//"
/etc/postgresql/pg_hba.conf
- /etc/init.d/postgresql reload
+ if [ -e $RESTFILE ] ; then
+ echo "Restoring $RESTFILE"
+ su -s /bin/sh postgres -c "dropdb $db_name" || true
+ su -s /bin/sh postgres -c "createdb --encoding=UNICODE $db_name"
|| true
+ su -s /bin/sh postgres -c "/usr/lib/postgresql/bin/psql -f
$RESTFILE $db_name"
+ perl -pi -e "s/### Next line inserted by GForge restore\n//"
/etc/postgresql/pg_hba.conf
+ perl -pi -e "s/$localtrust\n//" /etc/postgresql/pg_hba.conf
+ # perl -pi -e "s/host all 127.0.0.1 255.255.255.255 trust\n//"
/etc/postgresql/pg_hba.conf
+ /etc/init.d/postgresql reload
+ else
+ echo "No $RESTFILE to restore, skipping"
+ fi
;;
esac
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gforge-commits] gforge/deb-specific install-db.sh, 1.27.2.6, 1.27.2.7,
lo-lan-do <=
- Prev by Date:
[Gforge-commits] gforge/common/tracker ArtifactType.class, 1.21, 1.22 ArtifactTypeFactory.class, 1.6, 1.7
- Next by Date:
[Gforge-commits] gforge/common/include RoleObserver.class,1.1,1.2
- Previous by thread:
[Gforge-commits] gforge/common/tracker ArtifactType.class, 1.21, 1.22 ArtifactTypeFactory.class, 1.6, 1.7
- Next by thread:
[Gforge-commits] gforge/common/include RoleObserver.class,1.1,1.2
- Index(es):