|
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 354-359
END_BIBLIOS_RETRIEVAL_INFO=""
Link Here
|
| 354 |
START_AUTHORITIES_RETRIEVAL_INFO="" |
356 |
START_AUTHORITIES_RETRIEVAL_INFO="" |
| 355 |
END_AUTHORITIES_RETRIEVAL_INFO="" |
357 |
END_AUTHORITIES_RETRIEVAL_INFO="" |
| 356 |
|
358 |
|
|
|
359 |
APACHE_CONFIGFILE="" |
| 360 |
LETSENCRYPT_PATH="" |
| 361 |
|
| 357 |
if [ -e /etc/koha/koha-sites.conf ] |
362 |
if [ -e /etc/koha/koha-sites.conf ] |
| 358 |
then |
363 |
then |
| 359 |
. /etc/koha/koha-sites.conf |
364 |
. /etc/koha/koha-sites.conf |
|
Lines 361-367
fi
Link Here
|
| 361 |
|
366 |
|
| 362 |
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) |
367 |
[ $# -ge 1 ] && [ $# -le 16 ] || ( usage ; die "Error: wrong parameters" ) |
| 363 |
|
368 |
|
| 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:, \ |
369 |
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" -- "$@"` |
370 |
-n "$0" -- "$@"` |
| 366 |
|
371 |
|
| 367 |
# Note the quotes around `$TEMP': they are essential! |
372 |
# Note the quotes around `$TEMP': they are essential! |
|
Lines 378-384
CLO_MEMCACHED_SERVERS=""
Link Here
|
| 378 |
CLO_MEMCACHED_PREFIX="" |
383 |
CLO_MEMCACHED_PREFIX="" |
| 379 |
CLO_UPLOAD_PATH="" |
384 |
CLO_UPLOAD_PATH="" |
| 380 |
|
385 |
|
| 381 |
|
|
|
| 382 |
while true ; do |
386 |
while true ; do |
| 383 |
case "$1" in |
387 |
case "$1" in |
| 384 |
-c|--create-db) |
388 |
-c|--create-db) |
|
Lines 419-424
while true ; do
Link Here
|
| 419 |
SRU_SERVER_PORT="$2" ; shift 2 ;; |
423 |
SRU_SERVER_PORT="$2" ; shift 2 ;; |
| 420 |
--upload-path) |
424 |
--upload-path) |
| 421 |
CLO_UPLOAD_PATH="$2" ; shift 2 ;; |
425 |
CLO_UPLOAD_PATH="$2" ; shift 2 ;; |
|
|
426 |
--force-https) |
| 427 |
USE_HTTPS="yes" ; shift ;; |
| 428 |
--letsencrypt) |
| 429 |
LETSENCRYPT_PATH="$2" ; shift 2 ;; |
| 422 |
-h|--help) |
430 |
-h|--help) |
| 423 |
usage ; exit 0 ;; |
431 |
usage ; exit 0 ;; |
| 424 |
--) |
432 |
--) |
|
Lines 598-605
FLUSH PRIVILEGES;
Link Here
|
| 598 |
eof |
606 |
eof |
| 599 |
fi #` |
607 |
fi #` |
| 600 |
|
608 |
|
|
|
609 |
if [ "$USE_HTTPS" = "yes" ]; then |
| 610 |
APACHE_CONFIGFILE="apache-site-https.conf.in" |
| 611 |
else |
| 612 |
APACHE_CONFIGFILE="apache-site.conf.in" |
| 613 |
fi |
| 601 |
# Generate and install Apache site-available file and log dir. |
614 |
# Generate and install Apache site-available file and log dir. |
| 602 |
generate_config_file apache-site.conf.in \ |
615 |
generate_config_file $APACHE_CONFIGFILE \ |
| 603 |
"/etc/apache2/sites-available/$name.conf" |
616 |
"/etc/apache2/sites-available/$name.conf" |
| 604 |
mkdir "/var/log/koha/$name" |
617 |
mkdir "/var/log/koha/$name" |
| 605 |
chown "$username:$username" "/var/log/koha/$name" |
618 |
chown "$username:$username" "/var/log/koha/$name" |
|
Lines 708-713
then
Link Here
|
| 708 |
# Start Indexer daemon |
721 |
# Start Indexer daemon |
| 709 |
koha-indexer --start "$name" |
722 |
koha-indexer --start "$name" |
| 710 |
fi |
723 |
fi |
|
|
724 |
|
| 725 |
if [ "$USE_HTTPS" = "yes" ]; then |
| 726 |
# Get letsencrypt certificates |
| 727 |
# TODO: fix path of letsencrypt |
| 728 |
$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 |
| 729 |
# enable all ssl settings (apache won't start with these before certs are present) |
| 730 |
sed -i "s:^\s*#\(\s*SSL.*\)$:\1:" "/etc/apache2/sites-available/$name.conf" |
| 731 |
# change port from 80 to 443. (apache won't start if it is 443 without certs present) |
| 732 |
sed -i "s:^\s*\(<VirtualHost \*\:\)80> #ssl$:\1443>:" "/etc/apache2/sites-available/$name.conf" |
| 733 |
# TODO: enable forward from 80 to https |
| 734 |
# restart apache with working certs |
| 735 |
service apache2 restart |
| 736 |
fi |
| 711 |
fi |
737 |
fi |
| 712 |
|
738 |
|
| 713 |
|
739 |
|