Bugzilla – Attachment 46117 Details for
Bug 15303
Letsencrypt option for Debian package installations
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15303 Add --letsencrypt to koha-list
Bug-15303-Add---letsencrypt-to-koha-list.patch (text/plain), 6.50 KB, created by
Mirko Tietgen
on 2015-12-31 11:25:07 UTC
(
hide
)
Description:
Bug 15303 Add --letsencrypt to koha-list
Filename:
MIME Type:
Creator:
Mirko Tietgen
Created:
2015-12-31 11:25:07 UTC
Size:
6.50 KB
patch
obsolete
>From c0696e69e29dbb25c1183ace3f69d2daad2ad3fe Mon Sep 17 00:00:00 2001 >From: Mirko Tietgen <mirko@abunchofthings.net> >Date: Sat, 5 Dec 2015 14:14:16 +0100 >Subject: [PATCH] Bug 15303 Add --letsencrypt to koha-list > >Integrate --letsencrypt into koha-list, needed to have >letsencrypt-only cronjobs. Add _is_letsencrypt_enabled >--- > debian/scripts/koha-create | 2 + > debian/scripts/koha-functions.sh | 11 ++++++ > debian/scripts/koha-list | 81 ++++++++++++++++++++++++++++---------- > 3 files changed, 74 insertions(+), 20 deletions(-) > >diff --git a/debian/scripts/koha-create b/debian/scripts/koha-create >index 4363865..5cce7dc 100755 >--- a/debian/scripts/koha-create >+++ b/debian/scripts/koha-create >@@ -744,6 +744,8 @@ then > sed -i "s:^\s*\(<.*IfDefine.*> #https\)$:# \1:" "/etc/apache2/sites-available/$name.conf" > # change port from 80 to 443. (apache won't start if it is 443 without certs present) > sed -i "s:^\s*\(<VirtualHost \*\:\)80> #https$:\1443>:" "/etc/apache2/sites-available/$name.conf" >+ # make koha-list --letsencrypt aware of this instance # could be done by checking apache conf instead >+ touch $libdir/$instancename/letsencrypt.enabled > # restart apache with working certs > service apache2 restart > fi >diff --git a/debian/scripts/koha-functions.sh b/debian/scripts/koha-functions.sh >index 5ec633d..ab87a74 100755 >--- a/debian/scripts/koha-functions.sh >+++ b/debian/scripts/koha-functions.sh >@@ -84,6 +84,17 @@ is_email_enabled() > fi > } > >+is_letsencrypt_enabled() >+{ >+ local instancename=$1 >+ >+ if [ -e /var/lib/koha/$instancename/letsencrypt.enabled ]; then >+ return 0 >+ else >+ return 1 >+ fi >+} >+ > is_sip_enabled() > { > local instancename=$1 >diff --git a/debian/scripts/koha-list b/debian/scripts/koha-list >index 73ce075..0dd72e1 100755 >--- a/debian/scripts/koha-list >+++ b/debian/scripts/koha-list >@@ -36,24 +36,27 @@ show_instances() > for instance in $( get_instances ); do > case $show in > "all") >- if instance_filter_email $instance $show_email && \ >- instance_filter_plack $instance $show_plack && \ >- instance_filter_sip $instance $show_sip; then >+ if instance_filter_email $instance $show_email && \ >+ instance_filter_letsencrypt $instance $show_letsencrypt && \ >+ instance_filter_plack $instance $show_plack && \ >+ instance_filter_sip $instance $show_sip; then > echo $instance > fi ;; > "enabled") > if is_enabled $instance; then >- if instance_filter_email $instance $show_email && \ >- instance_filter_plack $instance $show_plack && \ >- instance_filter_sip $instance $show_sip; then >+ if instance_filter_email $instance $show_email && \ >+ instance_filter_letsencrypt $instance $show_letsencrypt && \ >+ instance_filter_plack $instance $show_plack && \ >+ instance_filter_sip $instance $show_sip; then > echo $instance > fi > fi ;; > "disabled") > if ! is_enabled $instance; then >- if instance_filter_email $instance $show_email && \ >- instance_filter_plack $instance $show_plack && \ >- instance_filter_sip $instance $show_sip; then >+ if instance_filter_email $instance $show_email && \ >+ instance_filter_letsencrypt $instance $show_letsencrypt && \ >+ instance_filter_plack $instance $show_plack && \ >+ instance_filter_sip $instance $show_sip; then > echo $instance > fi > fi ;; >@@ -106,6 +109,28 @@ instance_filter_plack() > return 1 > } > >+instance_filter_letsencrypt() >+{ >+ local instancename=$1 >+ local show_letsencrypt=$2; >+ >+ case $show_letsencrypt in >+ "all") >+ return 0 ;; >+ "enabled") >+ if is_letsencrypt_enabled $instancename; then >+ return 0 >+ fi ;; >+ "disabled") >+ if ! is_letsencrypt_enabled $instancename; then >+ return 0 >+ fi ;; >+ esac >+ >+ # Didn't match any criteria >+ return 1 >+} >+ > instance_filter_email() > { > local instancename=$1 >@@ -150,6 +175,17 @@ set_show_email() > fi > } > >+set_show_letsencrypt() >+{ >+ local letsencrypt_param=$1 >+ >+ if [ "$show_letsencrypt" = "all" ]; then >+ show_letsencrypt=$letsencrypt_param >+ else >+ die "Error: --letsencrypt and --noletsencrypt are mutually exclusive." >+ fi >+} >+ > set_show_plack() > { > local plack_param=$1 >@@ -190,6 +226,8 @@ Options: > --nosip Show instances with SIP disabled > --plack Show instances with Plack enabled > --noplack Show instances with Plack disabled >+ --letsencrypt Show instances with letsencrypt enabled >+ --noletsencrypt Show instances with letsencrypt disabled > --help | -h Show this help > > The filtering options can be combined, and you probably want to do this >@@ -201,23 +239,26 @@ show="all" > show_email="all" > show_sip="all" > show_plack="all" >+show_letsencrypt="all" > >-args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plack,noplack -o h -n $0 -- "$@") >+args=$(getopt -l help,enabled,disabled,email,noemail,sip,nosip,plack,noplack,letsencrypt,noletsencrypt -o h -n $0 -- "$@") > set -- $args > > while [ ! -z "$1" ] > do > case "$1" in >- -h|--help) usage; exit;; >- --email) set_show_email "enabled" ;; >- --noemail) set_show_email "disabled" ;; >- --sip) set_show_sip "enabled" ;; >- --nosip) set_show_sip "disabled" ;; >- --plack) set_show_plack "enabled" ;; >- --noplack) set_show_plack "disabled" ;; >- --enabled) set_show "enabled" ;; >- --disabled) set_show "disabled" ;; >- *) break;; >+ -h|--help) usage; exit;; >+ --email) set_show_email "enabled" ;; >+ --noemail) set_show_email "disabled" ;; >+ --sip) set_show_sip "enabled" ;; >+ --nosip) set_show_sip "disabled" ;; >+ --plack) set_show_plack "enabled" ;; >+ --noplack) set_show_plack "disabled" ;; >+ --letsencrypt) set_show_letsencrypt "enabled" ;; >+--noletsencrypt) set_show_letsencrypt "disabled" ;; >+ --enabled) set_show "enabled" ;; >+ --disabled) set_show "disabled" ;; >+ *) break;; > esac > shift > done >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 15303
:
45397
|
45399
|
45400
|
45402
|
45404
|
45408
|
45409
|
45414
|
45415
|
46116
|
46117
|
46118
|
46617
|
46742
|
46745
|
46746
|
46747
|
46748
|
46749
|
46750
|
46751
|
46752
|
49470
|
49471
|
50215
|
50216
|
50271
|
50283
|
50287
|
50307
|
50308
|
50309
|
50310
|
50311
|
50312
|
50313
|
50324