|
Lines 71-76
Options:
Link Here
|
| 71 |
conjunction with --defaultsql and --populate-db. |
71 |
conjunction with --defaultsql and --populate-db. |
| 72 |
--upload-path dir Set a user defined upload_path. It defaults to |
72 |
--upload-path dir Set a user defined upload_path. It defaults to |
| 73 |
/var/lib/koha/<instance>/uploads |
73 |
/var/lib/koha/<instance>/uploads |
|
|
74 |
--force-https Set up a https-only site with letsencrypt certificates |
| 75 |
--letsencrypt Path to the letsencrypt folder |
| 74 |
--help,-h Show this help. |
76 |
--help,-h Show this help. |
| 75 |
|
77 |
|
| 76 |
Note: the instance name cannot be longer that 11 chars. |
78 |
Note: the instance name cannot be longer that 11 chars. |
|
Lines 192-197
EOM
Link Here
|
| 192 |
die |
194 |
die |
| 193 |
fi |
195 |
fi |
| 194 |
|
196 |
|
|
|
197 |
# Check that mod_ssl is installed and enabled. |
| 198 |
if [ "$USE_HTTPS" = "yes" ]; then |
| 199 |
if ! /usr/sbin/apachectl -M 2> /dev/null | grep -q 'ssl_module'; then |
| 200 |
cat 1>&2 <<EOM |
| 201 |
|
| 202 |
Koha requires mod_ssl to be enabled within Apache in order to run with --force-https. |
| 203 |
Typically this can be enabled with: |
| 204 |
|
| 205 |
sudo a2enmod ssl |
| 206 |
EOM |
| 207 |
die |
| 208 |
fi |
| 209 |
fi |
| 210 |
|
| 195 |
} |
211 |
} |
| 196 |
|
212 |
|
| 197 |
set_biblios_indexing_mode() |
213 |
set_biblios_indexing_mode() |
|
Lines 354-359
END_BIBLIOS_RETRIEVAL_INFO=""
Link Here
|
| 354 |
START_AUTHORITIES_RETRIEVAL_INFO="" |
370 |
START_AUTHORITIES_RETRIEVAL_INFO="" |
| 355 |
END_AUTHORITIES_RETRIEVAL_INFO="" |
371 |
END_AUTHORITIES_RETRIEVAL_INFO="" |
| 356 |
|
372 |
|
|
|
373 |
APACHE_CONFIGFILE="" |
| 374 |
LETSENCRYPT_PATH="/usr/bin/" |
| 375 |
|
| 357 |
if [ -e /etc/koha/koha-sites.conf ] |
376 |
if [ -e /etc/koha/koha-sites.conf ] |
| 358 |
then |
377 |
then |
| 359 |
. /etc/koha/koha-sites.conf |
378 |
. /etc/koha/koha-sites.conf |
|
Lines 361-367
fi
Link Here
|
| 361 |
|
380 |
|
| 362 |
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) |
381 |
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) |
| 363 |
|
382 |
|
| 364 |
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:,upload-path:, \ |
383 |
TEMP=`getopt -o chrpm:l:d:f:b:a: -l create-db,request-db,populate-db,use-db,use-memcached,enable-sru,sru-port:,help,marcflavor:,auth-idx:,biblio-idx:,zebralang:,defaultsql:,configfile:,passwdfile:,database:,adminuser:,memcached-servers:,memcached-prefix:,upload-path:,force-https,letsencrypt:, \ |
| 365 |
-n "$0" -- "$@"` |
384 |
-n "$0" -- "$@"` |
| 366 |
|
385 |
|
| 367 |
# Note the quotes around `$TEMP': they are essential! |
386 |
# Note the quotes around `$TEMP': they are essential! |
|
Lines 378-384
CLO_MEMCACHED_SERVERS=""
Link Here
|
| 378 |
CLO_MEMCACHED_PREFIX="" |
397 |
CLO_MEMCACHED_PREFIX="" |
| 379 |
CLO_UPLOAD_PATH="" |
398 |
CLO_UPLOAD_PATH="" |
| 380 |
|
399 |
|
| 381 |
|
|
|
| 382 |
while true ; do |
400 |
while true ; do |
| 383 |
case "$1" in |
401 |
case "$1" in |
| 384 |
-c|--create-db) |
402 |
-c|--create-db) |
|
Lines 419-424
while true ; do
Link Here
|
| 419 |
SRU_SERVER_PORT="$2" ; shift 2 ;; |
437 |
SRU_SERVER_PORT="$2" ; shift 2 ;; |
| 420 |
--upload-path) |
438 |
--upload-path) |
| 421 |
CLO_UPLOAD_PATH="$2" ; shift 2 ;; |
439 |
CLO_UPLOAD_PATH="$2" ; shift 2 ;; |
|
|
440 |
--force-https) |
| 441 |
USE_HTTPS="yes" ; shift ;; |
| 442 |
--letsencrypt) |
| 443 |
LETSENCRYPT_PATH="$2" ; shift 2 ;; |
| 422 |
-h|--help) |
444 |
-h|--help) |
| 423 |
usage ; exit 0 ;; |
445 |
usage ; exit 0 ;; |
| 424 |
--) |
446 |
--) |
|
Lines 598-605
FLUSH PRIVILEGES;
Link Here
|
| 598 |
eof |
620 |
eof |
| 599 |
fi #` |
621 |
fi #` |
| 600 |
|
622 |
|
|
|
623 |
if [ "$USE_HTTPS" = "yes" ]; then |
| 624 |
APACHE_CONFIGFILE="apache-site-https.conf.in" |
| 625 |
else |
| 626 |
APACHE_CONFIGFILE="apache-site.conf.in" |
| 627 |
fi |
| 601 |
# Generate and install Apache site-available file and log dir. |
628 |
# Generate and install Apache site-available file and log dir. |
| 602 |
generate_config_file apache-site.conf.in \ |
629 |
generate_config_file $APACHE_CONFIGFILE \ |
| 603 |
"/etc/apache2/sites-available/$name.conf" |
630 |
"/etc/apache2/sites-available/$name.conf" |
| 604 |
mkdir "/var/log/koha/$name" |
631 |
mkdir "/var/log/koha/$name" |
| 605 |
chown "$username:$username" "/var/log/koha/$name" |
632 |
chown "$username:$username" "/var/log/koha/$name" |
|
Lines 708-713
then
Link Here
|
| 708 |
# Start Indexer daemon |
735 |
# Start Indexer daemon |
| 709 |
koha-indexer --start "$name" |
736 |
koha-indexer --start "$name" |
| 710 |
fi |
737 |
fi |
|
|
738 |
|
| 739 |
if [ "$USE_HTTPS" = "yes" ]; then |
| 740 |
# Get letsencrypt certificates |
| 741 |
# TODO: fix path of letsencrypt |
| 742 |
$LETSENCRYPT_PATH/letsencrypt-auto --agree-tos --renew-by-default --webroot --server https://acme-v01.api.letsencrypt.org/directory certonly -w /usr/share/koha/opac/htdocs/ -d $opacdomain -w /usr/share/koha/intranet/htdocs/ -d $intradomain |
| 743 |
# enable all ssl settings (apache won't start with these before certs are present) |
| 744 |
sed -i "s:^\s*\(<.*IfDefine.*> #https\)$:# \1:" "/etc/apache2/sites-available/$name.conf" |
| 745 |
# change port from 80 to 443. (apache won't start if it is 443 without certs present) |
| 746 |
sed -i "s:^\s*\(<VirtualHost \*\:\)80> #https$:\1443>:" "/etc/apache2/sites-available/$name.conf" |
| 747 |
# restart apache with working certs |
| 748 |
service apache2 restart |
| 749 |
fi |
| 711 |
fi |
750 |
fi |
| 712 |
|
751 |
|
| 713 |
|
752 |
|