commit changed configuration
[koha-eprints] / eprints-clone.sh
1 #!/bin/sh -xe
2
3 from=ffzg
4 to=bibliografija
5
6 ep=/usr/share/eprints3
7
8 bin="sudo -u eprints $ep/bin"
9
10 dir=/tmp/eprints-clone
11 test -d $dir || mkdir $dir
12
13 test -e $dir/$from.archive.xml || $bin/export $from archive XMLFiles > $dir/$from.archive.xml
14 #test -e $dir/$from.no-files.xml || $bin/export $from archive XML      > $dir/$from.no-files.xml
15 test -e $dir/$from.subject.xml || $bin/export $from subject XML      > $dir/$from.subject.xml
16 test -e $dir/$from.user.xml    || $bin/export $from user    XML      > $dir/$from.user.xml
17
18 if $bin/epadmin test $to ; then
19         echo "$to exists, skip import"
20 else
21         echo "$to import from $from started"
22         exit 1
23
24         $bin/epadmin create $to
25
26         cd /usr/share/eprints3/archives/$to/cfg
27         git init
28         git add *
29         git commit -m "new repository $to"
30
31         rsync -rv $ep/archives/$from/cfg/ $ep/archives/$to/cfg/
32
33         echo "restore core configuration of $to"
34         git diff cfg.d/adminemail.pl | patch -R -p1
35         git diff cfg.d/10_core.pl    | patch -R -p1
36         git diff lang/en/phrases/archive_name.xml | patch -R -p1
37
38         git diff cfg.d/database.pl | patch -R -p1
39
40         git commit -m "$from configuration changes" -a
41
42         echo "Modify databse for $from shema"
43         $bin/epadmin update $to
44
45         #$bin/epadmin              erase_data $to
46
47         echo "Importing data to $to"
48         $bin/import          --verbose       $to user   XML $dir/$from.user.xml
49         $bin/import_subjects --verbose --xml $to            $dir/$from.subject.xml
50         $bin/import          --verbose       $to eprint XML $dir/$from.archive.xml
51
52 fi
53
54
55