init cfg git repository tweak config, update db schema
authordpavlin <dpavlin@rot13.org>
Tue, 29 Oct 2013 20:35:48 +0000 (21:35 +0100)
committerdpavlin <dpavlin@rot13.org>
Tue, 29 Oct 2013 20:35:48 +0000 (21:35 +0100)
eprints-clone.sh

index b87fcf3..b50de24 100755 (executable)
@@ -3,16 +3,50 @@
 from=ffzg
 to=bibliografija
 
-bin="sudo -u eprints /usr/share/eprints3/bin"
+ep=/usr/share/eprints3
+
+bin="sudo -u eprints $ep/bin"
 
 dir=/tmp/eprints-clone
 test -d $dir || mkdir $dir
 
 test -e $dir/$from.archive.xml || $bin/export $from archive XMLFiles > $dir/$from.archive.xml
+#test -e $dir/$from.no-files.xml || $bin/export $from archive XML      > $dir/$from.no-files.xml
 test -e $dir/$from.subject.xml || $bin/export $from subject XML      > $dir/$from.subject.xml
 test -e $dir/$from.user.xml    || $bin/export $from user    XML      > $dir/$from.user.xml
 
-#$bin/epadmin              erase_data $to
-#$bin/import          --verbose       $to user   XML $dir/$from.user.xml
-#$bin/import_subjects --verbose --xml $to            $dir/$from.subject.xml
-$bin/import          --verbose       $to eprint XML $dir/$from.archive.xml
+if $bin/epadmin test $to ; then
+       echo "$to exists, skip import"
+else
+       echo "$to import from $from started"
+       exit 1
+
+       $bin/epadmin create $to
+
+       cd /usr/share/eprints3/archives/$to/cfg
+       git init
+       git add *
+       git commit -m "new repository $to"
+
+       rsync -rv $ep/archives/$from/cfg/ $ep/archives/$to/cfg/
+
+       echo "restore core configuration of $to"
+       git diff cfg.d/adminemail.pl | patch -R -p1
+       git diff cfg.d/10_core.pl    | patch -R -p1
+       git diff lang/en/phrases/archive_name.xml | patch -R -p1
+
+       git diff cfg.d/database.pl | patch -R -p1
+
+       echo "Modify databse for $from shema"
+       $bin/epadmin update $to
+
+       #$bin/epadmin              erase_data $to
+
+       $bin/import          --verbose       $to user   XML $dir/$from.user.xml
+       $bin/import_subjects --verbose --xml $to            $dir/$from.subject.xml
+       $bin/import          --verbose       $to eprint XML $dir/$from.archive.xml
+
+fi
+
+
+