diff options
author | Rob Austein <sra@hactrn.net> | 2014-10-07 02:41:44 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2014-10-07 02:41:44 +0000 |
commit | e3b6afdba7300602020fe225d9b6c0080e38a1a0 (patch) | |
tree | 010e0cc8aa0799f941c02e7530e5f928104757ea /ca | |
parent | 6bda36580e5f441f6061db89fbc4bb3a270d7b68 (diff) |
Seems that the earlier istallation success with new Apache
configuration on Precise was a false positive caused by an orphaned
symlink. Rewrite again to separate Debian and Ubuntu so we can do
version number checks in a halfway sane fashion.
Most likely the real underlying issue is Debian-family packaging for
Apache 2.2 vs Apache 2.4, so there may be possible to simplify this
again at some point, but in theory this will do for now.
Need to re-test on Trusty and Wheezy to make sure the fix for Precise
didn't break them. See #720.
svn path=/trunk/; revision=5995
Diffstat (limited to 'ca')
-rwxr-xr-x | ca/rpkigui-apache-conf-gen | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/ca/rpkigui-apache-conf-gen b/ca/rpkigui-apache-conf-gen index 36e75e71..a89111ca 100755 --- a/ca/rpkigui-apache-conf-gen +++ b/ca/rpkigui-apache-conf-gen @@ -152,8 +152,10 @@ def Guess(args): return Darwin(args) if system == "Linux": distro = platform.linux_distribution()[0].lower() - if distro in ("debian", "ubuntu"): + if distro == "debian": return Debian(args) + if distro == "ubuntu": + return Ubuntu(args) if distro in ("fedora", "centos"): return Redhat(args) raise NotImplementedError("Can't guess what platform this is, sorry") @@ -385,22 +387,17 @@ class Debian(Platform): Debian and related platforms like Ubuntu. """ - # Wheezy chokes if the .conf filename suffix is present. Trusty - # chokes if the .conf filename suffix is absent. Precise didn't - # seem to care last I checked. I suspect that this will work out to - # be specific to particular releases rather than a case of Debian - # consistently doing it one way and Ubuntu consistently doing it the - # other, so probably best to handle this at runtime rather than with - # through the class system. - # - # If I'm wrong, well, restructure it when we figure that out. + @property + def distribution_version(self): + return [int(v) for v in platform.linux_distribution()[1].split(".")] + + # As of Wheezy, Debian still wants the configuration filename + # without the .conf suffix. Keep an eye on this, as it may change + # in future releases. # @property def apache_conf_target(self): - if platform.linux_distribution()[0].lower() == "debian": - return "/etc/apache2/sites-available/rpki" - else: - return "/etc/apache2/sites-available/rpki.conf" + return "/etc/apache2/sites-available/rpki" snake_oil_cer = "/etc/ssl/certs/ssl-cert-snakeoil.pem" snake_oil_key = "/etc/ssl/private/ssl-cert-snakeoil.key" @@ -429,6 +426,17 @@ class Debian(Platform): def restart(self): self.run("service", "apache2", "restart") +class Ubuntu(Debian): + + # On Ubuntu, the filename must end in .conf on Trusty and must not + # end in .conf on Precise. + @property + def apache_conf_target(self): + if self.distribution_version >= (14, 0): + return "/etc/apache2/sites-available/rpki.conf" + else: + return "/etc/apache2/sites-available/rpki" + class NIY(Platform): def __init__(self, args): super(NIY, self).__init__(args) @@ -463,9 +471,12 @@ def main(): group1.add_argument("--freebsd", help = "configure for FreeBSD", action = "store_const", dest = "platform", const = FreeBSD) - group1.add_argument("--debian", "--ubuntu", - help = "configure for Debian/Ubuntu", + group1.add_argument("--debian", + help = "configure for Debian", action = "store_const", dest = "platform", const = Debian) + group1.add_argument("--ubuntu", + help = "configure for Ubuntu", + action = "store_const", dest = "platform", const = Ubuntu) group1.add_argument("--redhat", "--fedora", "--centos", help = "configure for Redhat/Fedora/CentOS", action = "store_const", dest = "platform", const = Redhat) |