|
Lines 31-37
my $biblios;
Link Here
|
| 31 |
my $authorities; |
31 |
my $authorities; |
| 32 |
my $noxml; |
32 |
my $noxml; |
| 33 |
my $noshadow; |
33 |
my $noshadow; |
| 34 |
my $do_munge; |
|
|
| 35 |
my $want_help; |
34 |
my $want_help; |
| 36 |
my $as_xml; |
35 |
my $as_xml; |
| 37 |
my $process_zebraqueue; |
36 |
my $process_zebraqueue; |
|
Lines 54-60
my $result = GetOptions(
Link Here
|
| 54 |
'b' => \$biblios, |
53 |
'b' => \$biblios, |
| 55 |
'noxml' => \$noxml, |
54 |
'noxml' => \$noxml, |
| 56 |
'w' => \$noshadow, |
55 |
'w' => \$noshadow, |
| 57 |
'munge-config' => \$do_munge, |
|
|
| 58 |
'a' => \$authorities, |
56 |
'a' => \$authorities, |
| 59 |
'h|help' => \$want_help, |
57 |
'h|help' => \$want_help, |
| 60 |
'x' => \$as_xml, |
58 |
'x' => \$as_xml, |
|
Lines 146-155
if ( $verbose_logging ) {
Link Here
|
| 146 |
print "================================\n"; |
144 |
print "================================\n"; |
| 147 |
} |
145 |
} |
| 148 |
|
146 |
|
| 149 |
if ($do_munge) { |
|
|
| 150 |
munge_config(); |
| 151 |
} |
| 152 |
|
| 153 |
my $tester = XML::LibXML->new(); |
147 |
my $tester = XML::LibXML->new(); |
| 154 |
|
148 |
|
| 155 |
if ($authorities) { |
149 |
if ($authorities) { |
|
Lines 745-1129
Parameters:
Link Here
|
| 745 |
--where let you specify a WHERE query, like itemtype='BOOK' |
739 |
--where let you specify a WHERE query, like itemtype='BOOK' |
| 746 |
or something like that |
740 |
or something like that |
| 747 |
|
741 |
|
| 748 |
--munge-config Deprecated option to try |
|
|
| 749 |
to fix Zebra config files. |
| 750 |
|
| 751 |
--run-as-root explicitily allow script to run as 'root' user |
742 |
--run-as-root explicitily allow script to run as 'root' user |
| 752 |
|
743 |
|
| 753 |
--help or -h show this message. |
744 |
--help or -h show this message. |
| 754 |
_USAGE_ |
745 |
_USAGE_ |
| 755 |
} |
746 |
} |
| 756 |
|
|
|
| 757 |
# FIXME: the following routines are deprecated and |
| 758 |
# will be removed once it is determined whether |
| 759 |
# a script to fix Zebra configuration files is |
| 760 |
# actually needed. |
| 761 |
sub munge_config { |
| 762 |
# |
| 763 |
# creating zebra-biblios.cfg depending on system |
| 764 |
# |
| 765 |
|
| 766 |
# getting zebraidx directory |
| 767 |
my $zebraidxdir; |
| 768 |
foreach (qw(/usr/local/bin/zebraidx |
| 769 |
/opt/bin/zebraidx |
| 770 |
/usr/bin/zebraidx |
| 771 |
)) { |
| 772 |
if ( -f $_ ) { |
| 773 |
$zebraidxdir=$_; |
| 774 |
} |
| 775 |
} |
| 776 |
|
| 777 |
unless ($zebraidxdir) { |
| 778 |
print qq| |
| 779 |
ERROR: could not find zebraidx directory |
| 780 |
ERROR: Either zebra is not installed, |
| 781 |
ERROR: or it's in a directory I don't checked. |
| 782 |
ERROR: do a which zebraidx and edit this file to add the result you get |
| 783 |
|; |
| 784 |
exit; |
| 785 |
} |
| 786 |
$zebraidxdir =~ s/\/bin\/.*//; |
| 787 |
print "Info : zebra is in $zebraidxdir \n"; |
| 788 |
|
| 789 |
# getting modules directory |
| 790 |
my $modulesdir; |
| 791 |
foreach (qw(/usr/local/lib/idzebra-2.0/modules/mod-grs-xml.so |
| 792 |
/usr/local/lib/idzebra/modules/mod-grs-xml.so |
| 793 |
/usr/lib/idzebra/modules/mod-grs-xml.so |
| 794 |
/usr/lib/idzebra-2.0/modules/mod-grs-xml.so |
| 795 |
)) { |
| 796 |
if ( -f $_ ) { |
| 797 |
$modulesdir=$_; |
| 798 |
} |
| 799 |
} |
| 800 |
|
| 801 |
unless ($modulesdir) { |
| 802 |
print qq| |
| 803 |
ERROR: could not find mod-grs-xml.so directory |
| 804 |
ERROR: Either zebra is not properly compiled (libxml2 is not setup and you don t have mod-grs-xml.so, |
| 805 |
ERROR: or it's in a directory I don't checked. |
| 806 |
ERROR: find where mod-grs-xml.so is and edit this file to add the result you get |
| 807 |
|; |
| 808 |
exit; |
| 809 |
} |
| 810 |
$modulesdir =~ s/\/modules\/.*//; |
| 811 |
print "Info: zebra modules dir : $modulesdir\n"; |
| 812 |
|
| 813 |
# getting tab directory |
| 814 |
my $tabdir; |
| 815 |
foreach (qw(/usr/local/share/idzebra/tab/explain.att |
| 816 |
/usr/local/share/idzebra-2.0/tab/explain.att |
| 817 |
/usr/share/idzebra/tab/explain.att |
| 818 |
/usr/share/idzebra-2.0/tab/explain.att |
| 819 |
)) { |
| 820 |
if ( -f $_ ) { |
| 821 |
$tabdir=$_; |
| 822 |
} |
| 823 |
} |
| 824 |
|
| 825 |
unless ($tabdir) { |
| 826 |
print qq| |
| 827 |
ERROR: could not find explain.att directory |
| 828 |
ERROR: Either zebra is not properly compiled, |
| 829 |
ERROR: or it's in a directory I don't checked. |
| 830 |
ERROR: find where explain.att is and edit this file to add the result you get |
| 831 |
|; |
| 832 |
exit; |
| 833 |
} |
| 834 |
$tabdir =~ s/\/tab\/.*//; |
| 835 |
print "Info: tab dir : $tabdir\n"; |
| 836 |
|
| 837 |
# |
| 838 |
# AUTHORITIES creating directory structure |
| 839 |
# |
| 840 |
my $created_dir_or_file = 0; |
| 841 |
if ($authorities) { |
| 842 |
if ( $verbose_logging ) { |
| 843 |
print "====================\n"; |
| 844 |
print "checking directories & files for authorities\n"; |
| 845 |
print "====================\n"; |
| 846 |
} |
| 847 |
unless (-d "$authorityserverdir") { |
| 848 |
system("mkdir -p $authorityserverdir"); |
| 849 |
print "Info: created $authorityserverdir\n"; |
| 850 |
$created_dir_or_file++; |
| 851 |
} |
| 852 |
unless (-d "$authorityserverdir/lock") { |
| 853 |
mkdir "$authorityserverdir/lock"; |
| 854 |
print "Info: created $authorityserverdir/lock\n"; |
| 855 |
$created_dir_or_file++; |
| 856 |
} |
| 857 |
unless (-d "$authorityserverdir/register") { |
| 858 |
mkdir "$authorityserverdir/register"; |
| 859 |
print "Info: created $authorityserverdir/register\n"; |
| 860 |
$created_dir_or_file++; |
| 861 |
} |
| 862 |
unless (-d "$authorityserverdir/shadow") { |
| 863 |
mkdir "$authorityserverdir/shadow"; |
| 864 |
print "Info: created $authorityserverdir/shadow\n"; |
| 865 |
$created_dir_or_file++; |
| 866 |
} |
| 867 |
unless (-d "$authorityserverdir/tab") { |
| 868 |
mkdir "$authorityserverdir/tab"; |
| 869 |
print "Info: created $authorityserverdir/tab\n"; |
| 870 |
$created_dir_or_file++; |
| 871 |
} |
| 872 |
unless (-d "$authorityserverdir/key") { |
| 873 |
mkdir "$authorityserverdir/key"; |
| 874 |
print "Info: created $authorityserverdir/key\n"; |
| 875 |
$created_dir_or_file++; |
| 876 |
} |
| 877 |
|
| 878 |
unless (-d "$authorityserverdir/etc") { |
| 879 |
mkdir "$authorityserverdir/etc"; |
| 880 |
print "Info: created $authorityserverdir/etc\n"; |
| 881 |
$created_dir_or_file++; |
| 882 |
} |
| 883 |
|
| 884 |
# |
| 885 |
# AUTHORITIES : copying mandatory files |
| 886 |
# |
| 887 |
# the record model, depending on marc flavour |
| 888 |
unless (-f "$authorityserverdir/tab/record.abs") { |
| 889 |
if (C4::Context->preference("marcflavour") eq "UNIMARC") { |
| 890 |
system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/authorities/record.abs $authorityserverdir/tab/record.abs"); |
| 891 |
print "Info: copied record.abs for UNIMARC\n"; |
| 892 |
} else { |
| 893 |
system("cp -f $kohadir/etc/zebradb/marc_defs/marc21/authorities/record.abs $authorityserverdir/tab/record.abs"); |
| 894 |
print "Info: copied record.abs for USMARC\n"; |
| 895 |
} |
| 896 |
$created_dir_or_file++; |
| 897 |
} |
| 898 |
unless (-f "$authorityserverdir/tab/sort-string-utf.chr") { |
| 899 |
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $authorityserverdir/tab/sort-string-utf.chr"); |
| 900 |
print "Info: copied sort-string-utf.chr\n"; |
| 901 |
$created_dir_or_file++; |
| 902 |
} |
| 903 |
unless (-f "$authorityserverdir/tab/word-phrase-utf.chr") { |
| 904 |
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $authorityserverdir/tab/word-phrase-utf.chr"); |
| 905 |
print "Info: copied word-phase-utf.chr\n"; |
| 906 |
$created_dir_or_file++; |
| 907 |
} |
| 908 |
unless (-f "$authorityserverdir/tab/auth1.att") { |
| 909 |
system("cp -f $kohadir/etc/zebradb/authorities/etc/bib1.att $authorityserverdir/tab/auth1.att"); |
| 910 |
print "Info: copied auth1.att\n"; |
| 911 |
$created_dir_or_file++; |
| 912 |
} |
| 913 |
unless (-f "$authorityserverdir/tab/default.idx") { |
| 914 |
system("cp -f $kohadir/etc/zebradb/etc/default.idx $authorityserverdir/tab/default.idx"); |
| 915 |
print "Info: copied default.idx\n"; |
| 916 |
$created_dir_or_file++; |
| 917 |
} |
| 918 |
|
| 919 |
unless (-f "$authorityserverdir/etc/ccl.properties") { |
| 920 |
# system("cp -f $kohadir/etc/zebradb/ccl.properties ".C4::Context->zebraconfig('authorityserver')->{ccl2rpn}); |
| 921 |
system("cp -f $kohadir/etc/zebradb/ccl.properties $authorityserverdir/etc/ccl.properties"); |
| 922 |
print "Info: copied ccl.properties\n"; |
| 923 |
$created_dir_or_file++; |
| 924 |
} |
| 925 |
unless (-f "$authorityserverdir/etc/pqf.properties") { |
| 926 |
# system("cp -f $kohadir/etc/zebradb/pqf.properties ".C4::Context->zebraconfig('authorityserver')->{ccl2rpn}); |
| 927 |
system("cp -f $kohadir/etc/zebradb/pqf.properties $authorityserverdir/etc/pqf.properties"); |
| 928 |
print "Info: copied pqf.properties\n"; |
| 929 |
$created_dir_or_file++; |
| 930 |
} |
| 931 |
|
| 932 |
# |
| 933 |
# AUTHORITIES : copying mandatory files |
| 934 |
# |
| 935 |
unless (-f C4::Context->zebraconfig('authorityserver')->{config}) { |
| 936 |
open my $zd, '>:encoding(UTF-8)' ,C4::Context->zebraconfig('authorityserver')->{config}; |
| 937 |
print {$zd} " |
| 938 |
# generated by KOHA/misc/migration_tools/rebuild_zebra.pl |
| 939 |
profilePath:\${srcdir:-.}:$authorityserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
| 940 |
|
| 941 |
encoding: UTF-8 |
| 942 |
# Files that describe the attribute sets supported. |
| 943 |
attset: auth1.att |
| 944 |
attset: explain.att |
| 945 |
attset: gils.att |
| 946 |
|
| 947 |
modulePath:$modulesdir/modules/ |
| 948 |
# Specify record type |
| 949 |
iso2709.recordType:grs.marcxml.record |
| 950 |
recordType:grs.xml |
| 951 |
recordId: (auth1,Local-Number) |
| 952 |
storeKeys:1 |
| 953 |
storeData:1 |
| 954 |
|
| 955 |
|
| 956 |
# Lock File Area |
| 957 |
lockDir: $authorityserverdir/lock |
| 958 |
perm.anonymous:r |
| 959 |
perm.kohaadmin:rw |
| 960 |
register: $authorityserverdir/register:4G |
| 961 |
shadow: $authorityserverdir/shadow:4G |
| 962 |
|
| 963 |
# Temp File area for result sets |
| 964 |
setTmpDir: $authorityserverdir/tmp |
| 965 |
|
| 966 |
# Temp File area for index program |
| 967 |
keyTmpDir: $authorityserverdir/key |
| 968 |
|
| 969 |
# Approx. Memory usage during indexing |
| 970 |
memMax: 40M |
| 971 |
rank:rank-1 |
| 972 |
"; |
| 973 |
print "Info: creating zebra-authorities.cfg\n"; |
| 974 |
$created_dir_or_file++; |
| 975 |
} |
| 976 |
|
| 977 |
if ($created_dir_or_file) { |
| 978 |
print "Info: created : $created_dir_or_file directories & files\n"; |
| 979 |
} else { |
| 980 |
print "Info: file & directories OK\n"; |
| 981 |
} |
| 982 |
|
| 983 |
} |
| 984 |
if ($biblios) { |
| 985 |
if ( $verbose_logging ) { |
| 986 |
print "====================\n"; |
| 987 |
print "checking directories & files for biblios\n"; |
| 988 |
print "====================\n"; |
| 989 |
} |
| 990 |
|
| 991 |
# |
| 992 |
# BIBLIOS : creating directory structure |
| 993 |
# |
| 994 |
unless (-d "$biblioserverdir") { |
| 995 |
system("mkdir -p $biblioserverdir"); |
| 996 |
print "Info: created $biblioserverdir\n"; |
| 997 |
$created_dir_or_file++; |
| 998 |
} |
| 999 |
unless (-d "$biblioserverdir/lock") { |
| 1000 |
mkdir "$biblioserverdir/lock"; |
| 1001 |
print "Info: created $biblioserverdir/lock\n"; |
| 1002 |
$created_dir_or_file++; |
| 1003 |
} |
| 1004 |
unless (-d "$biblioserverdir/register") { |
| 1005 |
mkdir "$biblioserverdir/register"; |
| 1006 |
print "Info: created $biblioserverdir/register\n"; |
| 1007 |
$created_dir_or_file++; |
| 1008 |
} |
| 1009 |
unless (-d "$biblioserverdir/shadow") { |
| 1010 |
mkdir "$biblioserverdir/shadow"; |
| 1011 |
print "Info: created $biblioserverdir/shadow\n"; |
| 1012 |
$created_dir_or_file++; |
| 1013 |
} |
| 1014 |
unless (-d "$biblioserverdir/tab") { |
| 1015 |
mkdir "$biblioserverdir/tab"; |
| 1016 |
print "Info: created $biblioserverdir/tab\n"; |
| 1017 |
$created_dir_or_file++; |
| 1018 |
} |
| 1019 |
unless (-d "$biblioserverdir/key") { |
| 1020 |
mkdir "$biblioserverdir/key"; |
| 1021 |
print "Info: created $biblioserverdir/key\n"; |
| 1022 |
$created_dir_or_file++; |
| 1023 |
} |
| 1024 |
unless (-d "$biblioserverdir/etc") { |
| 1025 |
mkdir "$biblioserverdir/etc"; |
| 1026 |
print "Info: created $biblioserverdir/etc\n"; |
| 1027 |
$created_dir_or_file++; |
| 1028 |
} |
| 1029 |
|
| 1030 |
# |
| 1031 |
# BIBLIOS : copying mandatory files |
| 1032 |
# |
| 1033 |
# the record model, depending on marc flavour |
| 1034 |
unless (-f "$biblioserverdir/tab/record.abs") { |
| 1035 |
if (C4::Context->preference("marcflavour") eq "UNIMARC") { |
| 1036 |
system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/biblios/record.abs $biblioserverdir/tab/record.abs"); |
| 1037 |
print "Info: copied record.abs for UNIMARC\n"; |
| 1038 |
} else { |
| 1039 |
system("cp -f $kohadir/etc/zebradb/marc_defs/marc21/biblios/record.abs $biblioserverdir/tab/record.abs"); |
| 1040 |
print "Info: copied record.abs for USMARC\n"; |
| 1041 |
} |
| 1042 |
$created_dir_or_file++; |
| 1043 |
} |
| 1044 |
unless (-f "$biblioserverdir/tab/sort-string-utf.chr") { |
| 1045 |
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $biblioserverdir/tab/sort-string-utf.chr"); |
| 1046 |
print "Info: copied sort-string-utf.chr\n"; |
| 1047 |
$created_dir_or_file++; |
| 1048 |
} |
| 1049 |
unless (-f "$biblioserverdir/tab/word-phrase-utf.chr") { |
| 1050 |
system("cp -f $kohadir/etc/zebradb/lang_defs/fr/sort-string-utf.chr $biblioserverdir/tab/word-phrase-utf.chr"); |
| 1051 |
print "Info: copied word-phase-utf.chr\n"; |
| 1052 |
$created_dir_or_file++; |
| 1053 |
} |
| 1054 |
unless (-f "$biblioserverdir/tab/bib1.att") { |
| 1055 |
system("cp -f $kohadir/etc/zebradb/biblios/etc/bib1.att $biblioserverdir/tab/bib1.att"); |
| 1056 |
print "Info: copied bib1.att\n"; |
| 1057 |
$created_dir_or_file++; |
| 1058 |
} |
| 1059 |
unless (-f "$biblioserverdir/tab/default.idx") { |
| 1060 |
system("cp -f $kohadir/etc/zebradb/etc/default.idx $biblioserverdir/tab/default.idx"); |
| 1061 |
print "Info: copied default.idx\n"; |
| 1062 |
$created_dir_or_file++; |
| 1063 |
} |
| 1064 |
unless (-f "$biblioserverdir/etc/ccl.properties") { |
| 1065 |
# system("cp -f $kohadir/etc/zebradb/ccl.properties ".C4::Context->zebraconfig('biblioserver')->{ccl2rpn}); |
| 1066 |
system("cp -f $kohadir/etc/zebradb/ccl.properties $biblioserverdir/etc/ccl.properties"); |
| 1067 |
print "Info: copied ccl.properties\n"; |
| 1068 |
$created_dir_or_file++; |
| 1069 |
} |
| 1070 |
unless (-f "$biblioserverdir/etc/pqf.properties") { |
| 1071 |
# system("cp -f $kohadir/etc/zebradb/pqf.properties ".C4::Context->zebraconfig('biblioserver')->{ccl2rpn}); |
| 1072 |
system("cp -f $kohadir/etc/zebradb/pqf.properties $biblioserverdir/etc/pqf.properties"); |
| 1073 |
print "Info: copied pqf.properties\n"; |
| 1074 |
$created_dir_or_file++; |
| 1075 |
} |
| 1076 |
|
| 1077 |
# |
| 1078 |
# BIBLIOS : copying mandatory files |
| 1079 |
# |
| 1080 |
unless (-f C4::Context->zebraconfig('biblioserver')->{config}) { |
| 1081 |
open my $zd, '>:encoding(UTF-8)', C4::Context->zebraconfig('biblioserver')->{config}; |
| 1082 |
print {$zd} " |
| 1083 |
# generated by KOHA/misc/migrtion_tools/rebuild_zebra.pl |
| 1084 |
profilePath:\${srcdir:-.}:$biblioserverdir/tab/:$tabdir/tab/:\${srcdir:-.}/tab/ |
| 1085 |
|
| 1086 |
encoding: UTF-8 |
| 1087 |
# Files that describe the attribute sets supported. |
| 1088 |
attset:bib1.att |
| 1089 |
attset:explain.att |
| 1090 |
attset:gils.att |
| 1091 |
|
| 1092 |
modulePath:$modulesdir/modules/ |
| 1093 |
# Specify record type |
| 1094 |
iso2709.recordType:grs.marcxml.record |
| 1095 |
recordType:grs.xml |
| 1096 |
recordId: (bib1,Local-Number) |
| 1097 |
storeKeys:1 |
| 1098 |
storeData:1 |
| 1099 |
|
| 1100 |
|
| 1101 |
# Lock File Area |
| 1102 |
lockDir: $biblioserverdir/lock |
| 1103 |
perm.anonymous:r |
| 1104 |
perm.kohaadmin:rw |
| 1105 |
register: $biblioserverdir/register:4G |
| 1106 |
shadow: $biblioserverdir/shadow:4G |
| 1107 |
|
| 1108 |
# Temp File area for result sets |
| 1109 |
setTmpDir: $biblioserverdir/tmp |
| 1110 |
|
| 1111 |
# Temp File area for index program |
| 1112 |
keyTmpDir: $biblioserverdir/key |
| 1113 |
|
| 1114 |
# Approx. Memory usage during indexing |
| 1115 |
memMax: 40M |
| 1116 |
rank:rank-1 |
| 1117 |
"; |
| 1118 |
print "Info: creating zebra-biblios.cfg\n"; |
| 1119 |
$created_dir_or_file++; |
| 1120 |
} |
| 1121 |
|
| 1122 |
if ($created_dir_or_file) { |
| 1123 |
print "Info: created : $created_dir_or_file directories & files\n"; |
| 1124 |
} else { |
| 1125 |
print "Info: file & directories OK\n"; |
| 1126 |
} |
| 1127 |
|
| 1128 |
} |
| 1129 |
} |
| 1130 |
- |