Lines 33-39
my $biblios;
Link Here
|
33 |
my $authorities; |
33 |
my $authorities; |
34 |
my $noxml; |
34 |
my $noxml; |
35 |
my $noshadow; |
35 |
my $noshadow; |
36 |
my $do_munge; |
|
|
37 |
my $want_help; |
36 |
my $want_help; |
38 |
my $as_xml; |
37 |
my $as_xml; |
39 |
my $process_zebraqueue; |
38 |
my $process_zebraqueue; |
Lines 58-64
my $result = GetOptions(
Link Here
|
58 |
'b' => \$biblios, |
57 |
'b' => \$biblios, |
59 |
'noxml' => \$noxml, |
58 |
'noxml' => \$noxml, |
60 |
'w' => \$noshadow, |
59 |
'w' => \$noshadow, |
61 |
'munge-config' => \$do_munge, |
|
|
62 |
'a' => \$authorities, |
60 |
'a' => \$authorities, |
63 |
'h|help' => \$want_help, |
61 |
'h|help' => \$want_help, |
64 |
'x' => \$as_xml, |
62 |
'x' => \$as_xml, |
Lines 164-173
if ( $verbose_logging ) {
Link Here
|
164 |
print "================================\n"; |
162 |
print "================================\n"; |
165 |
} |
163 |
} |
166 |
|
164 |
|
167 |
if ($do_munge) { |
|
|
168 |
munge_config(); |
169 |
} |
170 |
|
171 |
my $tester = XML::LibXML->new(); |
165 |
my $tester = XML::LibXML->new(); |
172 |
|
166 |
|
173 |
if ($daemon_mode) { |
167 |
if ($daemon_mode) { |
Lines 813-1197
Parameters:
Link Here
|
813 |
--where let you specify a WHERE query, like itemtype='BOOK' |
807 |
--where let you specify a WHERE query, like itemtype='BOOK' |
814 |
or something like that |
808 |
or something like that |
815 |
|
809 |
|
816 |
--munge-config Deprecated option to try |
|
|
817 |
to fix Zebra config files. |
818 |
|
819 |
--run-as-root explicitily allow script to run as 'root' user |
810 |
--run-as-root explicitily allow script to run as 'root' user |
820 |
|
811 |
|
821 |
--help or -h show this message. |
812 |
--help or -h show this message. |
822 |
_USAGE_ |
813 |
_USAGE_ |
823 |
} |
814 |
} |
824 |
|
|
|
825 |
# FIXME: the following routines are deprecated and |
826 |
# will be removed once it is determined whether |
827 |
# a script to fix Zebra configuration files is |
828 |
# actually needed. |
829 |
sub munge_config { |
830 |
# |
831 |
# creating zebra-biblios.cfg depending on system |
832 |
# |
833 |
|
834 |
# getting zebraidx directory |
835 |
my $zebraidxdir; |
836 |
foreach (qw(/usr/local/bin/zebraidx |
837 |
/opt/bin/zebraidx |
838 |
/usr/bin/zebraidx |
839 |
)) { |
840 |
if ( -f $_ ) { |
841 |
$zebraidxdir=$_; |
842 |
} |
843 |
} |
844 |
|
845 |
unless ($zebraidxdir) { |
846 |
print qq| |
847 |
ERROR: could not find zebraidx directory |
848 |
ERROR: Either zebra is not installed, |
849 |
ERROR: or it's in a directory I don't checked. |
850 |
ERROR: do a which zebraidx and edit this file to add the result you get |
851 |
|; |
852 |
exit; |
853 |
} |
854 |
$zebraidxdir =~ s/\/bin\/.*//; |
855 |
print "Info : zebra is in $zebraidxdir \n"; |
856 |
|
857 |
# getting modules directory |
858 |
my $modulesdir; |
859 |
foreach (qw(/usr/local/lib/idzebra-2.0/modules/mod-grs-xml.so |
860 |
/usr/local/lib/idzebra/modules/mod-grs-xml.so |
861 |
/usr/lib/idzebra/modules/mod-grs-xml.so |
862 |
/usr/lib/idzebra-2.0/modules/mod-grs-xml.so |
863 |
)) { |
864 |
if ( -f $_ ) { |
865 |
$modulesdir=$_; |
866 |
} |
867 |
} |
868 |
|
869 |
unless ($modulesdir) { |
870 |
print qq| |
871 |
ERROR: could not find mod-grs-xml.so directory |
872 |
ERROR: Either zebra is not properly compiled (libxml2 is not setup and you don t have mod-grs-xml.so, |
873 |
ERROR: or it's in a directory I don't checked. |
874 |
ERROR: find where mod-grs-xml.so is and edit this file to add the result you get |
875 |
|; |
876 |
exit; |
877 |
} |
878 |
$modulesdir =~ s/\/modules\/.*//; |
879 |
print "Info: zebra modules dir : $modulesdir\n"; |
880 |
|
881 |
# getting tab directory |
882 |
my $tabdir; |
883 |
foreach (qw(/usr/local/share/idzebra/tab/explain.att |
884 |
/usr/local/share/idzebra-2.0/tab/explain.att |
885 |
/usr/share/idzebra/tab/explain.att |
886 |
/usr/share/idzebra-2.0/tab/explain.att |
887 |
)) { |
888 |
if ( -f $_ ) { |
889 |
$tabdir=$_; |
890 |
} |
891 |
} |
892 |
|
893 |
unless ($tabdir) { |
894 |
print qq| |
895 |
ERROR: could not find explain.att directory |
896 |
ERROR: Either zebra is not properly compiled, |
897 |
ERROR: or it's in a directory I don't checked. |
898 |
ERROR: find where explain.att is and edit this file to add the result you get |
899 |
|; |
900 |
exit; |
901 |
} |
902 |
$tabdir =~ s/\/tab\/.*//; |
903 |
print "Info: tab dir : $tabdir\n"; |
904 |
|
905 |
# |
906 |
# AUTHORITIES creating directory structure |
907 |
# |
908 |
my $created_dir_or_file = 0; |
909 |
if ($authorities) { |
910 |
if ( $verbose_logging ) { |
911 |
print "====================\n"; |
912 |
print "checking directories & files for authorities\n"; |
913 |
print "====================\n"; |
914 |
} |
915 |
unless (-d "$authorityserverdir") { |
916 |
system("mkdir -p $authorityserverdir"); |
917 |
print "Info: created $authorityserverdir\n"; |
918 |
$created_dir_or_file++; |
919 |
} |
920 |
unless (-d "$authorityserverdir/lock") { |
921 |
mkdir "$authorityserverdir/lock"; |
922 |
print "Info: created $authorityserverdir/lock\n"; |
923 |
$created_dir_or_file++; |
924 |
} |
925 |
unless (-d "$authorityserverdir/register") { |
926 |
mkdir "$authorityserverdir/register"; |
927 |
print "Info: created $authorityserverdir/register\n"; |
928 |
$created_dir_or_file++; |
929 |
} |
930 |
unless (-d "$authorityserverdir/shadow") { |
931 |
mkdir "$authorityserverdir/shadow"; |
932 |
print "Info: created $authorityserverdir/shadow\n"; |
933 |
$created_dir_or_file++; |
934 |
} |
935 |
unless (-d "$authorityserverdir/tab") { |
936 |
mkdir "$authorityserverdir/tab"; |
937 |
print "Info: created $authorityserverdir/tab\n"; |
938 |
$created_dir_or_file++; |
939 |
} |
940 |
unless (-d "$authorityserverdir/key") { |
941 |
mkdir "$authorityserverdir/key"; |
942 |
print "Info: created $authorityserverdir/key\n"; |
943 |
$created_dir_or_file++; |
944 |
} |
945 |
|
946 |
unless (-d "$authorityserverdir/etc") { |
947 |
mkdir "$authorityserverdir/etc"; |
948 |
print "Info: created $authorityserverdir/etc\n"; |
949 |
$created_dir_or_file++; |
950 |
} |
951 |
|
952 |
# |
953 |
# AUTHORITIES : copying mandatory files |
954 |
# |
955 |
# the record model, depending on marc flavour |
956 |
unless (-f "$authorityserverdir/tab/record.abs") { |
957 |
if (C4::Context->preference("marcflavour") eq "UNIMARC") { |
958 |
system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/authorities/record.abs $authorityserverdir/tab/record.abs"); |
959 |
print "Info: copied record.abs for UNIMARC\n"; |
960 |
} else { |
961 |
system("cp -f $kohadir/etc/zebradb/marc_defs/marc21/authorities/record.abs $authorityserverdir/tab/record.abs"); |
962 |
print "Info: copied record.abs for USMARC\n"; |
963 |
} |
964 |
$created_dir_or_file++; |
965 |
} |
966 |
unless (-f "$authorityserverdir/tab/sort-string-utf.chr") { |
967 |
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $authorityserverdir/tab/sort-string-utf.chr"); |
968 |
print "Info: copied sort-string-utf.chr\n"; |
969 |
$created_dir_or_file++; |
970 |
} |
971 |
unless (-f "$authorityserverdir/tab/word-phrase-utf.chr") { |
972 |
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $authorityserverdir/tab/word-phrase-utf.chr"); |
973 |
print "Info: copied word-phase-utf.chr\n"; |
974 |
$created_dir_or_file++; |
975 |
} |
976 |
unless (-f "$authorityserverdir/tab/auth1.att") { |
977 |
system("cp -f $kohadir/etc/zebradb/authorities/etc/bib1.att $authorityserverdir/tab/auth1.att"); |
978 |
print "Info: copied auth1.att\n"; |
979 |
$created_dir_or_file++; |
980 |
} |
981 |
unless (-f "$authorityserverdir/tab/default.idx") { |
982 |
system("cp -f $kohadir/etc/zebradb/etc/default.idx $authorityserverdir/tab/default.idx"); |
983 |
print "Info: copied default.idx\n"; |
984 |
$created_dir_or_file++; |
985 |
} |
986 |
|
987 |
unless (-f "$authorityserverdir/etc/ccl.properties") { |
988 |
# system("cp -f $kohadir/etc/zebradb/ccl.properties ".C4::Context->zebraconfig('authorityserver')->{ccl2rpn}); |
989 |
system("cp -f $kohadir/etc/zebradb/ccl.properties $authorityserverdir/etc/ccl.properties"); |
990 |
print "Info: copied ccl.properties\n"; |
991 |
$created_dir_or_file++; |
992 |
} |
993 |
unless (-f "$authorityserverdir/etc/pqf.properties") { |
994 |
# system("cp -f $kohadir/etc/zebradb/pqf.properties ".C4::Context->zebraconfig('authorityserver')->{ccl2rpn}); |
995 |
system("cp -f $kohadir/etc/zebradb/pqf.properties $authorityserverdir/etc/pqf.properties"); |
996 |
print "Info: copied pqf.properties\n"; |
997 |
$created_dir_or_file++; |
998 |
} |
999 |
|
1000 |
# |
1001 |
# AUTHORITIES : copying mandatory files |
1002 |
# |
1003 |
unless (-f C4::Context->zebraconfig('authorityserver')->{config}) { |
1004 |
open my $zd, '>:encoding(UTF-8)' ,C4::Context->zebraconfig('authorityserver')->{config}; |
1005 |
print {$zd} " |
1006 |
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl |
1007 |
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
1008 |
|
1009 |
encoding: UTF-8 |
1010 |
# Files that describe the attribute sets supported. |
1011 |
attset: auth1.att |
1012 |
attset: explain.att |
1013 |
attset: gils.att |
1014 |
|
1015 |
modulePath:$modulesdir/modules/ |
1016 |
# Specify record type |
1017 |
iso2709.recordType:grs.marcxml.record |
1018 |
recordType:grs.xml |
1019 |
recordId: (auth1,Local-Number) |
1020 |
storeKeys:1 |
1021 |
storeData:1 |
1022 |
|
1023 |
|
1024 |
# Lock File Area |
1025 |
lockDir: $authorityserverdir/lock |
1026 |
perm.anonymous:r |
1027 |
perm.kohaadmin:rw |
1028 |
register: $authorityserverdir/register:4G |
1029 |
shadow: $authorityserverdir/shadow:4G |
1030 |
|
1031 |
# Temp File area for result sets |
1032 |
setTmpDir: $authorityserverdir/tmp |
1033 |
|
1034 |
# Temp File area for index program |
1035 |
keyTmpDir: $authorityserverdir/key |
1036 |
|
1037 |
# Approx. Memory usage during indexing |
1038 |
memMax: 40M |
1039 |
rank:rank-1 |
1040 |
"; |
1041 |
print "Info: creating zebra-authorities.cfg\n"; |
1042 |
$created_dir_or_file++; |
1043 |
} |
1044 |
|
1045 |
if ($created_dir_or_file) { |
1046 |
print "Info: created : $created_dir_or_file directories & files\n"; |
1047 |
} else { |
1048 |
print "Info: file & directories OK\n"; |
1049 |
} |
1050 |
|
1051 |
} |
1052 |
if ($biblios) { |
1053 |
if ( $verbose_logging ) { |
1054 |
print "====================\n"; |
1055 |
print "checking directories & files for biblios\n"; |
1056 |
print "====================\n"; |
1057 |
} |
1058 |
|
1059 |
# |
1060 |
# BIBLIOS : creating directory structure |
1061 |
# |
1062 |
unless (-d "$biblioserverdir") { |
1063 |
system("mkdir -p $biblioserverdir"); |
1064 |
print "Info: created $biblioserverdir\n"; |
1065 |
$created_dir_or_file++; |
1066 |
} |
1067 |
unless (-d "$biblioserverdir/lock") { |
1068 |
mkdir "$biblioserverdir/lock"; |
1069 |
print "Info: created $biblioserverdir/lock\n"; |
1070 |
$created_dir_or_file++; |
1071 |
} |
1072 |
unless (-d "$biblioserverdir/register") { |
1073 |
mkdir "$biblioserverdir/register"; |
1074 |
print "Info: created $biblioserverdir/register\n"; |
1075 |
$created_dir_or_file++; |
1076 |
} |
1077 |
unless (-d "$biblioserverdir/shadow") { |
1078 |
mkdir "$biblioserverdir/shadow"; |
1079 |
print "Info: created $biblioserverdir/shadow\n"; |
1080 |
$created_dir_or_file++; |
1081 |
} |
1082 |
unless (-d "$biblioserverdir/tab") { |
1083 |
mkdir "$biblioserverdir/tab"; |
1084 |
print "Info: created $biblioserverdir/tab\n"; |
1085 |
$created_dir_or_file++; |
1086 |
} |
1087 |
unless (-d "$biblioserverdir/key") { |
1088 |
mkdir "$biblioserverdir/key"; |
1089 |
print "Info: created $biblioserverdir/key\n"; |
1090 |
$created_dir_or_file++; |
1091 |
} |
1092 |
unless (-d "$biblioserverdir/etc") { |
1093 |
mkdir "$biblioserverdir/etc"; |
1094 |
print "Info: created $biblioserverdir/etc\n"; |
1095 |
$created_dir_or_file++; |
1096 |
} |
1097 |
|
1098 |
# |
1099 |
# BIBLIOS : copying mandatory files |
1100 |
# |
1101 |
# the record model, depending on marc flavour |
1102 |
unless (-f "$biblioserverdir/tab/record.abs") { |
1103 |
if (C4::Context->preference("marcflavour") eq "UNIMARC") { |
1104 |
system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/biblios/record.abs $biblioserverdir/tab/record.abs"); |
1105 |
print "Info: copied record.abs for UNIMARC\n"; |
1106 |
} else { |
1107 |
system("cp -f $kohadir/etc/zebradb/marc_defs/marc21/biblios/record.abs $biblioserverdir/tab/record.abs"); |
1108 |
print "Info: copied record.abs for USMARC\n"; |
1109 |
} |
1110 |
$created_dir_or_file++; |
1111 |
} |
1112 |
unless (-f "$biblioserverdir/tab/sort-string-utf.chr") { |
1113 |
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $biblioserverdir/tab/sort-string-utf.chr"); |
1114 |
print "Info: copied sort-string-utf.chr\n"; |
1115 |
$created_dir_or_file++; |
1116 |
} |
1117 |
unless (-f "$biblioserverdir/tab/word-phrase-utf.chr") { |
1118 |
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $biblioserverdir/tab/word-phrase-utf.chr"); |
1119 |
print "Info: copied word-phase-utf.chr\n"; |
1120 |
$created_dir_or_file++; |
1121 |
} |
1122 |
unless (-f "$biblioserverdir/tab/bib1.att") { |
1123 |
system("cp -f $kohadir/etc/zebradb/biblios/etc/bib1.att $biblioserverdir/tab/bib1.att"); |
1124 |
print "Info: copied bib1.att\n"; |
1125 |
$created_dir_or_file++; |
1126 |
} |
1127 |
unless (-f "$biblioserverdir/tab/default.idx") { |
1128 |
system("cp -f $kohadir/etc/zebradb/etc/default.idx $biblioserverdir/tab/default.idx"); |
1129 |
print "Info: copied default.idx\n"; |
1130 |
$created_dir_or_file++; |
1131 |
} |
1132 |
unless (-f "$biblioserverdir/etc/ccl.properties") { |
1133 |
# system("cp -f $kohadir/etc/zebradb/ccl.properties ".C4::Context->zebraconfig('biblioserver')->{ccl2rpn}); |
1134 |
system("cp -f $kohadir/etc/zebradb/ccl.properties $biblioserverdir/etc/ccl.properties"); |
1135 |
print "Info: copied ccl.properties\n"; |
1136 |
$created_dir_or_file++; |
1137 |
} |
1138 |
unless (-f "$biblioserverdir/etc/pqf.properties") { |
1139 |
# system("cp -f $kohadir/etc/zebradb/pqf.properties ".C4::Context->zebraconfig('biblioserver')->{ccl2rpn}); |
1140 |
system("cp -f $kohadir/etc/zebradb/pqf.properties $biblioserverdir/etc/pqf.properties"); |
1141 |
print "Info: copied pqf.properties\n"; |
1142 |
$created_dir_or_file++; |
1143 |
} |
1144 |
|
1145 |
# |
1146 |
# BIBLIOS : copying mandatory files |
1147 |
# |
1148 |
unless (-f C4::Context->zebraconfig('biblioserver')->{config}) { |
1149 |
open my $zd, '>:encoding(UTF-8)', C4::Context->zebraconfig('biblioserver')->{config}; |
1150 |
print {$zd} " |
1151 |
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl |
1152 |
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
1153 |
|
1154 |
encoding: UTF-8 |
1155 |
# Files that describe the attribute sets supported. |
1156 |
attset:bib1.att |
1157 |
attset:explain.att |
1158 |
attset:gils.att |
1159 |
|
1160 |
modulePath:$modulesdir/modules/ |
1161 |
# Specify record type |
1162 |
iso2709.recordType:grs.marcxml.record |
1163 |
recordType:grs.xml |
1164 |
recordId: (bib1,Local-Number) |
1165 |
storeKeys:1 |
1166 |
storeData:1 |
1167 |
|
1168 |
|
1169 |
# Lock File Area |
1170 |
lockDir: $biblioserverdir/lock |
1171 |
perm.anonymous:r |
1172 |
perm.kohaadmin:rw |
1173 |
register: $biblioserverdir/register:4G |
1174 |
shadow: $biblioserverdir/shadow:4G |
1175 |
|
1176 |
# Temp File area for result sets |
1177 |
setTmpDir: $biblioserverdir/tmp |
1178 |
|
1179 |
# Temp File area for index program |
1180 |
keyTmpDir: $biblioserverdir/key |
1181 |
|
1182 |
# Approx. Memory usage during indexing |
1183 |
memMax: 40M |
1184 |
rank:rank-1 |
1185 |
"; |
1186 |
print "Info: creating zebra-biblios.cfg\n"; |
1187 |
$created_dir_or_file++; |
1188 |
} |
1189 |
|
1190 |
if ($created_dir_or_file) { |
1191 |
print "Info: created : $created_dir_or_file directories & files\n"; |
1192 |
} else { |
1193 |
print "Info: file & directories OK\n"; |
1194 |
} |
1195 |
|
1196 |
} |
1197 |
} |
1198 |
- |