|
Lines 2-302
Link Here
|
| 2 |
|
2 |
|
| 3 |
set -e |
3 |
set -e |
| 4 |
|
4 |
|
| 5 |
# Default to "yes" |
|
|
| 6 |
AUTOMATIC_TRANSLATIONS_UPDATE="yes" |
| 7 |
|
| 8 |
. /usr/share/debconf/confmodule |
| 9 |
|
| 10 |
# Read configuration variable file if it is present |
| 11 |
CONFIG=/etc/koha/koha-common.conf |
| 12 |
if [ -r $CONFIG ]; then |
| 13 |
. $CONFIG |
| 14 |
fi |
| 15 |
|
| 16 |
conf=/etc/mysql/koha-common.cnf |
| 17 |
if [ ! -e "$conf" ] && [ ! -L "$conf" ]; then |
| 18 |
ln -s debian.cnf "$conf" |
| 19 |
fi |
| 20 |
|
| 21 |
#DEBHELPER# |
5 |
#DEBHELPER# |
| 22 |
|
6 |
|
| 23 |
koha-upgrade-schema $(koha-list) |
|
|
| 24 |
|
| 25 |
# Generate a config file if one doesn't exist already |
| 26 |
if [ ! -e $CONFIG ]; then |
| 27 |
cat <<EOF >$CONFIG |
| 28 |
## Automatic template translation update |
| 29 |
# |
| 30 |
# This variable controls whether template translations should |
| 31 |
# be updated automatically on koha-common package upgrades. |
| 32 |
# Options: 'yes' (default) |
| 33 |
# 'no' |
| 34 |
# Note: if you choose 'no' then you will have to issue |
| 35 |
# $ koha-translate --update <lang_code> |
| 36 |
# |
| 37 |
AUTOMATIC_TRANSLATIONS_UPDATE="yes" |
| 38 |
EOF |
| 39 |
fi |
| 40 |
|
| 41 |
# Substitute the values from debconf into the file. |
| 42 |
db_get koha-common/automatically-update-translations |
| 43 |
UPDATE="$RET" |
| 44 |
if [ "$UPDATE" = "false" ]; then |
| 45 |
UPDATE="no" |
| 46 |
else |
| 47 |
UPDATE="yes" |
| 48 |
fi |
| 49 |
# In case they were removed/commented out, we add it in. |
| 50 |
grep -Eq '^ *AUTOMATIC_TRANSLATIONS_UPDATE=' $CONFIG || |
| 51 |
echo "AUTOMATIC_TRANSLATIONS_UPDATE=" >>$CONFIG |
| 52 |
|
| 53 |
sed -e "s/^ *AUTOMATIC_TRANSLATIONS_UPDATE=.*/AUTOMATIC_TRANSLATIONS_UPDATE=\"$UPDATE\"/" <$CONFIG >$CONFIG.tmp |
| 54 |
mv -f $CONFIG.tmp $CONFIG |
| 55 |
|
| 56 |
if [ "$AUTOMATIC_TRANSLATIONS_UPDATE" = "yes" ]; then |
| 57 |
for lang in $(koha-translate --list | grep -v -x "en"); do |
| 58 |
if koha-translate --update $lang; then |
| 59 |
echo "Updated the $lang translations." |
| 60 |
else |
| 61 |
cat <<EOF >&2 |
| 62 |
ERROR: an error was found when updating '$lang' translations. Please manually |
| 63 |
run 'koha-translate --update $lang'. Run man koha-translate for more options. |
| 64 |
EOF |
| 65 |
fi |
| 66 |
done |
| 67 |
else |
| 68 |
# no auto-update, check update needed and warn if needed |
| 69 |
if koha-translate --list | grep -v -q -x "en"; then |
| 70 |
# translations installed, update needed |
| 71 |
cat <<EOF >&2 |
| 72 |
Warning: template translations are not set to be automatically updated. |
| 73 |
Please manually run 'koha-translate --update lang_code' to update them. |
| 74 |
|
| 75 |
You can run 'koha-translate --list' to get a list of the installed translations codes. |
| 76 |
EOF |
| 77 |
fi |
| 78 |
fi |
| 79 |
|
| 80 |
# Check if we need to rename the Apache vhost files |
| 81 |
RENAME_APACHE_FILES="no" |
| 82 |
for vhost in $(koha-list); do |
| 83 |
if [ -f "/etc/apache2/sites-available/$vhost" ] && |
| 84 |
[ ! -f "/etc/apache2/sites-available/$vhost.conf" ]; then |
| 85 |
RENAME_APACHE_FILES="yes" |
| 86 |
break # at least one, trigger renaming |
| 87 |
fi |
| 88 |
done |
| 89 |
|
| 90 |
if [ "$RENAME_APACHE_FILES" = "yes" ]; then |
| 91 |
# If the user agreed we now rename their Apache files |
| 92 |
db_get koha-common/rename-apache-vhost-files |
| 93 |
if [ "$RET" = "false" ]; then |
| 94 |
# We're not renaming the files, just print a warning |
| 95 |
cat <<EOF >&2 |
| 96 |
Warning: you have chosen not to migrate your Apache virtual hosts files to the |
| 97 |
Apache 2.4 naming schema. You can do it manually by running this for each |
| 98 |
Koha instance: |
| 99 |
|
| 100 |
$ sudo a2dissite instance |
| 101 |
$ sudo mv /etc/apache2/sites-available/instance \ |
| 102 |
/etc/apache2/sites-available/instance.conf |
| 103 |
$ sudo a2ensite instance |
| 104 |
EOF |
| 105 |
else |
| 106 |
# We have to rename the Apache files |
| 107 |
for site in $(koha-list); do |
| 108 |
ENABLE_VHOST="yes" |
| 109 |
if [ -f "/etc/apache2/sites-available/$site" ] && |
| 110 |
[ ! -f "/etc/apache2/sites-available/$site.conf" ]; then |
| 111 |
if [ ! -f "/etc/apache2/sites-enabled/$site" ]; then |
| 112 |
ENABLE_VHOST="no" |
| 113 |
fi |
| 114 |
a2dissite $site >/dev/null 2>&1 || true |
| 115 |
rm -f "/etc/apache2/sites-enabled/$site" |
| 116 |
# Rename the vhost definition files |
| 117 |
mv "/etc/apache2/sites-available/$site" \ |
| 118 |
"/etc/apache2/sites-available/$site.conf" |
| 119 |
|
| 120 |
if [ "$ENABLE_VHOST" = "yes" ]; then |
| 121 |
if ! { |
| 122 |
a2ensite "$site" >/dev/null 2>&1 || |
| 123 |
a2ensite "${site}.conf" >/dev/null 2>&1 |
| 124 |
}; then |
| 125 |
echo "Warning: problem enabling $site in Apache" >&2 |
| 126 |
fi |
| 127 |
fi |
| 128 |
fi |
| 129 |
done |
| 130 |
fi |
| 131 |
fi |
| 132 |
|
| 133 |
log4perl_component() { |
| 134 |
local config=$1 |
| 135 |
local component=$2 |
| 136 |
|
| 137 |
if grep -q "log4perl.logger.$component" $config; then |
| 138 |
return 0 |
| 139 |
else |
| 140 |
return 1 |
| 141 |
fi |
| 142 |
} |
| 143 |
|
| 144 |
# Take care of the instance's log4perl.conf file |
| 145 |
for site in $(koha-list); do |
| 146 |
log4perl_config="/etc/koha/sites/$site/log4perl.conf" |
| 147 |
if ! log4perl_component $log4perl_config "z3950"; then |
| 148 |
cat <<EOF >>$log4perl_config |
| 149 |
log4perl.logger.z3950 = WARN, Z3950 |
| 150 |
log4perl.appender.Z3950=Log::Log4perl::Appender::File |
| 151 |
log4perl.appender.Z3950.filename=/var/log/koha/$site/z3950-error.log |
| 152 |
log4perl.appender.Z3950.mode=append |
| 153 |
log4perl.appender.Z3950.layout=PatternLayout |
| 154 |
log4perl.appender.Z3950.layout.ConversionPattern=[%d] [%p] %m %l%n |
| 155 |
log4perl.appender.Z3950.utf8=1 |
| 156 |
|
| 157 |
EOF |
| 158 |
fi |
| 159 |
|
| 160 |
if ! log4perl_component $log4perl_config "api"; then |
| 161 |
cat <<EOF >>$log4perl_config |
| 162 |
log4perl.logger.api = WARN, API |
| 163 |
log4perl.appender.API=Log::Log4perl::Appender::File |
| 164 |
log4perl.appender.API.filename=/var/log/koha/$site/api-error.log |
| 165 |
log4perl.appender.API.mode=append |
| 166 |
log4perl.appender.API.layout=PatternLayout |
| 167 |
log4perl.appender.API.layout.ConversionPattern=[%d] [%p] %m %l%n |
| 168 |
log4perl.appender.API.utf8=1 |
| 169 |
|
| 170 |
EOF |
| 171 |
fi |
| 172 |
done |
| 173 |
|
| 174 |
for site in $(koha-list); do |
| 175 |
log4perl_config="/etc/koha/sites/$site/log4perl.conf" |
| 176 |
if ! log4perl_component $log4perl_config "sip"; then |
| 177 |
cat <<EOF >>$log4perl_config |
| 178 |
log4perl.logger.sip = DEBUG, SIP |
| 179 |
log4perl.appender.SIP=Log::Log4perl::Appender::File |
| 180 |
log4perl.appender.SIP.filename=/var/log/koha/$site/sip-output.log |
| 181 |
log4perl.appender.SIP.mode=append |
| 182 |
log4perl.appender.SIP.layout=PatternLayout |
| 183 |
log4perl.appender.SIP.layout.ConversionPattern=[%d] [%P] [%p] %X{accountid}@%X{peeraddr}: %m %l%n |
| 184 |
log4perl.appender.SIP.utf8=1 |
| 185 |
|
| 186 |
EOF |
| 187 |
fi |
| 188 |
done |
| 189 |
|
| 190 |
for site in $(koha-list); do |
| 191 |
log4perl_config="/etc/koha/sites/$site/log4perl.conf" |
| 192 |
if ! log4perl_component $log4perl_config "plack-opac"; then |
| 193 |
cat <<EOF >>$log4perl_config |
| 194 |
log4perl.logger.plack-opac = WARN, PLACKOPAC |
| 195 |
log4perl.appender.PLACKOPAC=Log::Log4perl::Appender::File |
| 196 |
log4perl.appender.PLACKOPAC.filename=/var/log/koha/$site/plack-opac-error.log |
| 197 |
log4perl.appender.PLACKOPAC.mode=append |
| 198 |
log4perl.appender.PLACKOPAC.layout=PatternLayout |
| 199 |
log4perl.appender.PLACKOPAC.layout.ConversionPattern=[%d] [%p] %m%n |
| 200 |
log4perl.appender.PLACKOPAC.utf8=1 |
| 201 |
|
| 202 |
EOF |
| 203 |
fi |
| 204 |
done |
| 205 |
|
| 206 |
for site in $(koha-list); do |
| 207 |
log4perl_config="/etc/koha/sites/$site/log4perl.conf" |
| 208 |
if ! log4perl_component $log4perl_config "plack-api"; then |
| 209 |
cat <<EOF >>$log4perl_config |
| 210 |
log4perl.logger.plack-api = WARN, PLACKAPI |
| 211 |
log4perl.appender.PLACKAPI=Log::Log4perl::Appender::File |
| 212 |
log4perl.appender.PLACKAPI.filename=/var/log/koha/$site/plack-api-error.log |
| 213 |
log4perl.appender.PLACKAPI.mode=append |
| 214 |
log4perl.appender.PLACKAPI.layout=PatternLayout |
| 215 |
log4perl.appender.PLACKAPI.layout.ConversionPattern=[%d] [%p] %m%n |
| 216 |
log4perl.appender.PLACKAPI.utf8=1 |
| 217 |
|
| 218 |
EOF |
| 219 |
fi |
| 220 |
done |
| 221 |
|
| 222 |
for site in $(koha-list); do |
| 223 |
log4perl_config="/etc/koha/sites/$site/log4perl.conf" |
| 224 |
if ! log4perl_component $log4perl_config "plack-intranet"; then |
| 225 |
cat <<EOF >>$log4perl_config |
| 226 |
log4perl.logger.plack-intranet = WARN, PLACKINTRANET |
| 227 |
log4perl.appender.PLACKINTRANET=Log::Log4perl::Appender::File |
| 228 |
log4perl.appender.PLACKINTRANET.filename=/var/log/koha/$site/plack-intranet-error.log |
| 229 |
log4perl.appender.PLACKINTRANET.mode=append |
| 230 |
log4perl.appender.PLACKINTRANET.layout=PatternLayout |
| 231 |
log4perl.appender.PLACKINTRANET.layout.ConversionPattern=[%d] [%p] %m%n |
| 232 |
log4perl.appender.PLACKINTRANET.utf8=1 |
| 233 |
|
| 234 |
EOF |
| 235 |
fi |
| 236 |
done |
| 237 |
|
| 238 |
for site in $(koha-list); do |
| 239 |
log4perl_config="/etc/koha/sites/$site/log4perl.conf" |
| 240 |
if ! log4perl_component $log4perl_config "worker"; then |
| 241 |
cat <<EOF >>$log4perl_config |
| 242 |
log4perl.logger.worker = WARN, WORKER |
| 243 |
log4perl.appender.WORKER=Log::Log4perl::Appender::Screen |
| 244 |
log4perl.appender.WORKER.stderr=1 |
| 245 |
log4perl.appender.WORKER.layout=PatternLayout |
| 246 |
log4perl.appender.WORKER.layout.ConversionPattern=[%d] [%p] %m %l%n |
| 247 |
log4perl.appender.WORKER.utf8=1 |
| 248 |
|
| 249 |
EOF |
| 250 |
fi |
| 251 |
done |
| 252 |
|
| 253 |
for site in $(koha-list); do |
| 254 |
log4perl_config="/etc/koha/sites/$site/log4perl.conf" |
| 255 |
if ! log4perl_component $log4perl_config "edi"; then |
| 256 |
cat <<EOF >>$log4perl_config |
| 257 |
log4perl.logger.edi = TRACE, EDI |
| 258 |
log4perl.appender.EDI=Log::Log4perl::Appender::File |
| 259 |
log4perl.appender.EDI.filename=/var/log/koha/$site/editrace.log |
| 260 |
log4perl.appender.EDI.mode=append |
| 261 |
log4perl.appender.EDI.layout=PatternLayout |
| 262 |
log4perl.appender.EDI.layout.ConversionPattern=[%d] [%P] [%p] %X{accountid}@%X{peeraddr}: %m %l%n |
| 263 |
log4perl.appender.EDI.utf8=1 |
| 264 |
|
| 265 |
EOF |
| 266 |
fi |
| 267 |
done |
| 268 |
|
| 269 |
for site in $(koha-list); do |
| 270 |
kohaconfig="/etc/koha/sites/$site/koha-conf.xml" |
| 271 |
logdir="$(xmlstarlet sel -t -v 'yazgfs/config/logdir' $kohaconfig)" |
| 272 |
if [ "$logdir" != "" ] && [ "$logdir" != "0" ]; then |
| 273 |
chown -R $site-koha:$site-koha $logdir |
| 274 |
else |
| 275 |
chown -R $site-koha:$site-koha /var/log/koha/$site |
| 276 |
fi |
| 277 |
done |
| 278 |
|
| 279 |
# Bug 14106 - fix the modulePath of existing koha instances so that it'll |
| 280 |
# continue to work. This will only patch the files if the exact original string |
| 281 |
# that we're fixing them from is there, so we just run it every time. Maybe |
| 282 |
# in many years time we can get rid of this, when no one will be running |
| 283 |
# Koha < 3.20. |
| 284 |
for zfile in $(find /etc/koha/sites -name zebra-authorities-dom.cfg -or -name zebra-biblios-dom.cfg); do |
| 285 |
perl -p -i -e 's{^modulePath: /usr/lib/idzebra-2.0/modules$}{modulePath: /usr/lib/idzebra-2.0/modules:/usr/lib/x86_64-linux-gnu/idzebra-2.0/modules:/usr/lib/i386-linux-gnu/idzebra-2.0/modules:/usr/lib/aarch64-linux-gnu/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabi/idzebra-2.0/modules:/usr/lib/arm-linux-gnueabihf/idzebra-2.0/modules:/usr/lib/mips-linux-gnu/idzebra-2.0/modules:/usr/lib/mipsel-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc-linux-gnu/idzebra-2.0/modules:/usr/lib/powerpc64le-linux-gnu/idzebra-2.0/modules:/usr/lib/s390x-linux-gnu/idzebra-2.0/modules}' $zfile |
| 286 |
done |
| 287 |
|
| 288 |
db_stop |
| 289 |
|
| 290 |
rabbitmq-plugins enable rabbitmq_stomp |
| 291 |
service rabbitmq-server restart |
| 292 |
|
| 293 |
# Bug 35242: Force memcache restart after koha install/upgrade |
| 294 |
service memcached restart |
| 295 |
|
| 296 |
# Bug 18250: Correct startup order of koha-common and memcached |
| 297 |
# Since the init script has been updated, we can force the order in rc.d |
| 298 |
# by disabling and enabling again. |
| 299 |
update-rc.d koha-common disable |
| 300 |
update-rc.d koha-common enable |
| 301 |
|
| 302 |
exit 0 |
7 |
exit 0 |
| 303 |
- |
|
|