Update of /cvsroot/refdb/refdb/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17912
Modified Files:
refdb-backup refdb-restore
Log Message:
Changed archive format from 'zip' to 'tar.gz'.
Index: refdb-backup
===================================================================
RCS file: /cvsroot/refdb/refdb/scripts/refdb-backup,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -U2 -r1.2 -r1.3
--- refdb-backup 30 Jan 2005 10:31:25 -0000 1.2
+++ refdb-backup 30 Jan 2005 13:39:34 -0000 1.3
@@ -14,6 +14,6 @@
notes_backup="xnotes.xml"
styles_directory="styles"
-logfile="log"
-zipfile="refdb_backup_`date '+%Y%m%d_%H%M'`"
+logfile="log_backup"
+archive="refdb_backup_`date '+%Y%m%d_%H%M'`.tar.gz"
@@ -92,4 +92,5 @@
* ) endScript "No format selected." "failed";;
esac
+echo ; echo "References storage format: ${format}." ; echo
# Record date/time of backup
@@ -146,5 +147,6 @@
echo "Compressing to archive"
echo -n " Writing archive ... "
-find . -name '*' | zip ${zipfile} -@ &> /dev/null
+#find . -name '*' | zip ${archive} -@ &> /dev/null
+tar -czf ${archive} *
report $?
echo -n " Deleting backup files ... "
@@ -157,4 +159,4 @@
# Finished
-echo ; echo "Backup archive: '${zipfile}.zip'."
+echo ; echo "Backup archive: '${archive}'."
endScript "Backup finished." "succeeded"
Index: refdb-restore
===================================================================
RCS file: /cvsroot/refdb/refdb/scripts/refdb-restore,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -U2 -r1.2 -r1.3
--- refdb-restore 30 Jan 2005 10:31:25 -0000 1.2
+++ refdb-restore 30 Jan 2005 13:39:34 -0000 1.3
@@ -17,5 +17,5 @@
notes_backup="xnotes.xml"
styles_directory="styles"
-logfile="log"
+logfile="log_restore"
@@ -70,5 +70,5 @@
db=$2
base=$3
- filelist=`unzip -l $1 | sed -e 's/ \+/ /g' | cut -d ' ' -f 5 | grep -v '^$' | sed -e '1,2d' | grep -v "/$" | grep "^db_"`
+ filelist=`tar -tzf $1 | grep -v "/$" | grep "^db_"`
[ `echo "${filelist}" | grep "^db_${db}/${references_backup}.xml"` ] \
&& extension="xml"
@@ -105,7 +105,8 @@
# - must exist and be readable
[ -r $1 ] || endScript "Cannot read backup archive '$1'." "failed"
-# - must be valid archive
-unzip -t $1 &> /dev/null
-[ $? -ne 0 ] && endScript "'$1' is not a valid zip archive." "failed"
+# - must be valid archive (this test is a bit crude - just list
+# archive contents and check exit status)
+tar -tzf $1 &> /dev/null
+[ $? -ne 0 ] && endScript "'$1' is not a valid archive." "failed"
# Informational message
@@ -119,5 +120,5 @@
# Cycle through databases in turn and restore references and notes
-for dbdir in `unzip -l $1 | sed -e 's/ \+/ /g' | cut -d ' ' -f 5 | grep -v '^$' | sed -e '1,2d' | grep "/$"` ; do
+for dbdir in `tar -tzf $1 | grep "/$"` ; do
# get db name
if [ ${dbdir} != "styles/" ] ; then
@@ -126,5 +127,4 @@
echo "Restoring database: ${db}" | tee -a ${logfile}
# restore references
- #reffile="db_${db}/${references_backup}"
reffile=`get_filename $1 ${db} ${references_backup}`
echo " Restore references" | tee -a ${logfile}
@@ -132,5 +132,5 @@
echo -n " Extracting temporary file ... " | tee -a ${logfile}
echo "" >> ${logfile}
- unzip $1 ${reffile} >> ${logfile}
+ tar -xzf $1 ${reffile} >> ${logfile}
report $?
# - create database
@@ -153,5 +153,5 @@
echo -n " Extracting temporary file ... " | tee -a ${logfile}
echo "" >> ${logfile}
- unzip $1 ${notefile} >> ${logfile}
+ tar -xzf $1 ${notefile} >> ${logfile}
report $?
# - add notes
@@ -172,9 +172,9 @@
# Restore styles
echo "Restoring styles" | tee -a ${logfile}
-for stylefile in `unzip -l $1 | sed -e 's/ \+/ /g' | cut -d ' ' -f 5 | grep -v '^$' | sed -e '1,2d' | grep "^styles/[[:print:]]\+"` ; do
+for stylefile in `tar -tzf $1 | grep "^styles/[[:print:]]\+"` ; do
# extract style file
echo -n " Extracting style: " | tee -a ${logfile}
echo "" >> ${logfile}
- unzip $1 ${stylefile} >> ${logfile}
+ tar -xzf $1 ${stylefile} >> ${logfile}
if [ $? -eq 0 ] ; then
# extract style name
|