View | Details | Raw Unified | Return to bug 15303
Collapse All | Expand All

(-)a/debian/scripts/koha-create (-1 / +1 lines)
Lines 361-367 letsencrypt_instance() Link Here
361
    # enable redirect from http to https on port 80
361
    # enable redirect from http to https on port 80
362
    sed -i "s:^\s*#\(.*\)#nohttps$:\1:" "/etc/apache2/sites-available/$name.conf"
362
    sed -i "s:^\s*#\(.*\)#nohttps$:\1:" "/etc/apache2/sites-available/$name.conf"
363
    # make koha-list --letsencrypt aware of this instance # could be done by checking apache conf instead
363
    # make koha-list --letsencrypt aware of this instance # could be done by checking apache conf instead
364
    touch /var/lib/koha/$name/letsencrypt.enabled
364
    echo -e "opacdomain=\"$opacdomain\"\nintradomain=\"$intradomain\"" > /var/lib/koha/$name/letsencrypt.enabled
365
    # restart apache with working certs
365
    # restart apache with working certs
366
    service apache2 restart
366
    service apache2 restart
367
}
367
}
(-)a/debian/scripts/koha-functions.sh (+40 lines)
Lines 43-48 get_apache_config_for() Link Here
43
    fi
43
    fi
44
}
44
}
45
45
46
get_opacdomain_for()
47
{
48
    local site=$1
49
50
    if [ -e /etc/koha/koha-sites.conf ]; then
51
        . /etc/koha/koha-sites.conf
52
    else
53
        echo "Error: /etc/koha/koha-sites.conf not present." 1>&2
54
        exit 1
55
    fi
56
    local opacdomain="$OPACPREFIX$site$OPACSUFFIX$DOMAIN"
57
    echo "$opacdomain"
58
}
59
60
get_intradomain_for()
61
{
62
    local site=$1
63
64
    if [ -e /etc/koha/koha-sites.conf ]; then
65
        . /etc/koha/koha-sites.conf
66
    else
67
        echo "Error: /etc/koha/koha-sites.conf not present." 1>&2
68
        exit 1
69
    fi
70
    local intradomain="$INTRAPREFIX$site$INTRASUFFIX$DOMAIN"
71
    echo "$intradomain"
72
}
73
74
letsencrypt_get_opacdomain_for()
75
{
76
    local site=$1
77
78
    if [ -e /var/lib/koha/$site/letsencrypt.enabled ]; then
79
        . /var/lib/koha/$site/letsencrypt.enabled
80
    else
81
        local opacdomain=$(get_opacdomain_for $site)
82
    fi
83
    echo "$opacdomain"
84
}
85
46
is_enabled()
86
is_enabled()
47
{
87
{
48
    local site=$1
88
    local site=$1
(-)a/debian/scripts/koha-remove (-1 / +5 lines)
Lines 80-85 eof Link Here
80
    koha-stop-zebra $name || /bin/true
80
    koha-stop-zebra $name || /bin/true
81
81
82
    instancefile=$(get_apache_config_for $name)
82
    instancefile=$(get_apache_config_for $name)
83
    le_opacdomain=$(letsencrypt_get_opacdomain_for $name)
83
84
84
    [ -f "$instancefile" ]  && \
85
    [ -f "$instancefile" ]  && \
85
        rm "$instancefile"
86
        rm "$instancefile"
Lines 97-102 eof Link Here
97
        rm "/etc/koha/sites/$name/zebra-authorities-dom.cfg"
98
        rm "/etc/koha/sites/$name/zebra-authorities-dom.cfg"
98
    [ -f "/etc/koha/sites/$name/zebra.passwd" ] && \
99
    [ -f "/etc/koha/sites/$name/zebra.passwd" ] && \
99
        rm "/etc/koha/sites/$name/zebra.passwd"
100
        rm "/etc/koha/sites/$name/zebra.passwd"
101
    [ -f "/var/lib/koha/$name/letsencrypt.enabled" ] && \
102
        rm -r "/var/lib/koha/$name/letsencrypt.enabled"
103
    [ -f "/etc/letsencrypt/renewal/$le_opacdomain.conf" ] && \
104
        rm -r "/etc/letsencrypt/renewal/$le_opacdomain.conf"
100
    # Maybe a user has left something in the config directory they want to keep? We won't delete it here, nor throw an error if the have.
105
    # Maybe a user has left something in the config directory they want to keep? We won't delete it here, nor throw an error if the have.
101
    [ -d "/etc/koha/sites/$name" ] && \
106
    [ -d "/etc/koha/sites/$name" ] && \
102
        rmdir --ignore-fail-on-non-empty "/etc/koha/sites/$name"
107
        rmdir --ignore-fail-on-non-empty "/etc/koha/sites/$name"
103
- 

Return to bug 15303