Create symlink from intranet/zebra to head zebra directory
[koha_fer] / misc / sync_koha_plugin.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use C4::Context;
5 use Getopt::Long;
6
7 my %opt = ();
8 GetOptions(
9     \%opt,
10     qw/head_dir=s rel_2_2_dir=s help/
11 ) or die "\nHouston, we got a problem\n";
12
13 if (exists $opt{help}) {
14     print <<FIN;
15 Sync the Koha plugin with the appropriate files from HEAD. Assumes
16 that you've set up your Koha install to use CVS symlinked to the
17 normal locations.
18
19 Usage: sync_koha_plugin.pl --head_dir=<cvs head directory>
20                            --rel_2_2_dir=<cvs rel_2_2 directory>
21                         [--help]
22
23 --head_dir: is the directory where your Koha HEAD cvs is checked out.
24
25 --rel_2_2_dir: is the directory where your Koha rel_2_2 cvs is checked
26 out and symlinked to your Koha install directories.
27
28 --help: show this help
29
30 FIN
31
32       exit(0);
33 }
34 # Configurable Variables
35 foreach my $option (qw/head_dir rel_2_2_dir/) {
36   if (not exists $opt{$option}) {
37     die 'option "', $option, '" is mandatory', "\n";
38   }
39
40   if (not -d $opt{$option}) {
41     die '"', $opt{$option}, '" must be an existing directory', "\n";
42   }
43
44   if (not $opt{$option} =~ m{^/}) {
45     die '--', $option, ' must be an absolute path', "\n";
46   }
47 }
48
49 ## Modules
50 system(
51     'cp',
52     $opt{head_dir}.'/C4/Biblio.pm',
53     $opt{rel_2_2_dir}.'/C4/'
54 );
55 system(
56     'cp',
57     $opt{head_dir}.'/C4/Context.pm',
58     $opt{rel_2_2_dir}.'/C4/'
59 );
60 system(
61     'cp',
62     $opt{head_dir}.'/C4/SearchMarc.pm',
63     $opt{rel_2_2_dir}.'/C4/'
64 );
65 system(
66     'cp',
67     $opt{head_dir}.'/C4/Amazon.pm',
68     $opt{rel_2_2_dir}.'/C4/'
69 );
70 system(
71     'cp',
72     $opt{head_dir}.'/C4/Review.pm',
73     $opt{rel_2_2_dir}.'/C4/'
74 );
75 system(
76     'cp',
77     $opt{head_dir}.'/C4/Search.pm',
78     $opt{rel_2_2_dir}.'/C4/'
79 );
80
81 ## Intranet
82 system(
83     'cp',
84     $opt{head_dir}.'/cataloguing/addbiblio.pl',
85     $opt{rel_2_2_dir}.'/acqui.simple/addbiblio.pl'
86 );
87 system(
88     'cp',
89     $opt{head_dir}.'/cataloguing/additem.pl',
90     $opt{rel_2_2_dir}.'/acqui.simple/'
91 );
92 system(
93     'cp',
94     $opt{head_dir}.'/catalogue/detail.pl',
95     $opt{rel_2_2_dir}.'/'
96 );
97 system(
98     'cp',
99     $opt{head_dir}.'/catalogue/MARCdetail.pl',
100     $opt{rel_2_2_dir}.'/'
101 );
102 system(
103     'cp',
104     $opt{head_dir}.'/catalogue/ISBDdetail.pl',
105     $opt{rel_2_2_dir}.'/'
106 );
107
108 # OPAC
109 system(
110     'cp',
111     $opt{head_dir}.'/opac/opac-detail.pl',
112     $opt{rel_2_2_dir}.'/opac/'
113 );
114 system(
115     'cp',
116     $opt{head_dir}.'/opac/opac-MARCdetail.pl',
117     $opt{rel_2_2_dir}.'/opac/'
118 );
119 system(
120     'cp',
121     $opt{head_dir}.'/opac/opac-ISBDdetail.pl',
122     $opt{rel_2_2_dir}.'/opac/'
123 );
124
125 ## Add the symlink necessary due to changes in the dir structure
126 system(
127     'ln',
128     '-s',
129     $opt{rel_2_2_dir}.'/koha-tmpl/intranet-tmpl/npl/en/acqui.simple',
130     $opt{rel_2_2_dir}.'/koha-tmpl/intranet-tmpl/npl/en/cataloguing'
131 );
132
133 ## Add the 'record.abs' symlink
134 system(
135     'ln',
136     '-s',
137     $opt{head_dir}.'/misc/zebra/usmarc/collection.abs',
138     $opt{head_dir}.'/misc/zebra/usmarc/record.abs'
139 );
140
141 ## Create symlink from intranet/zebra to head zebra directory
142 system(
143     'ln',
144     '-s',
145     $opt{head_dir}.'/misc/zebra/usmarc',
146     C4::Context->config("intranetdir").'/zebra'
147 );
148
149 print "Finished\n\nRemember, you still need to:
150
151 1. Edit moredetail.tmpl and detail.tmpl to allow for deletions
152 2. symlink your Koha directory's intranet/zebra dir to the zebra dir
153    where the pqf file is
154 3. add  <option value="biblio.title">Title</option> to the detail.tmpl
155    pages to sort by relevance by default
156
157 \n";
158