From 2e96287d773b6fd24750793b6378bc85773650ee Mon Sep 17 00:00:00 2001 From: treydock Date: Sat, 6 Nov 2021 17:58:33 -0400 Subject: [PATCH] Numerous fixes for deb package (#1576) * Numerous fixes for deb package Use absolute paths for Apache symlinks, works with Puppet Ensure that both ood-portal.conf and checksum exist inside package to do what RPM does to make things behave the same with automation * Can not package ood-portal.conf and also modify it in postinst --- .../lib/ood_portal_generator/application.rb | 2 +- ood-portal-generator/spec/application_spec.rb | 2 +- packaging/deb/postinst | 17 ++++++++++------- packaging/deb/postrm | 5 +++-- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ood-portal-generator/lib/ood_portal_generator/application.rb b/ood-portal-generator/lib/ood_portal_generator/application.rb index 160378eb17..7088be0360 100644 --- a/ood-portal-generator/lib/ood_portal_generator/application.rb +++ b/ood-portal-generator/lib/ood_portal_generator/application.rb @@ -65,7 +65,7 @@ def insecure def apache return ENV['APACHE'] unless ENV['APACHE'].nil? - return '/etc/apache2/conf-available/ood-portal.conf' if OodPortalGenerator.debian? + return '/etc/apache2/sites-available/ood-portal.conf' if OodPortalGenerator.debian? OodPortalGenerator.scl_apache? ? '/opt/rh/httpd24/root/etc/httpd/conf.d/ood-portal.conf' : '/etc/httpd/conf.d/ood-portal.conf' end diff --git a/ood-portal-generator/spec/application_spec.rb b/ood-portal-generator/spec/application_spec.rb index 34848c08bd..411a70fbc7 100644 --- a/ood-portal-generator/spec/application_spec.rb +++ b/ood-portal-generator/spec/application_spec.rb @@ -378,7 +378,7 @@ def test_generate(input, output) it 'should work for Debian systems' do allow(OodPortalGenerator).to receive(:scl_apache?).and_return(false) allow(OodPortalGenerator).to receive(:debian?).and_return(true) - expect(described_class.apache).to eq('/etc/apache2/conf-available/ood-portal.conf') + expect(described_class.apache).to eq('/etc/apache2/sites-available/ood-portal.conf') end end diff --git a/packaging/deb/postinst b/packaging/deb/postinst index 6e63021f77..cbdc306cf1 100755 --- a/packaging/deb/postinst +++ b/packaging/deb/postinst @@ -6,6 +6,9 @@ touch /var/lib/ondemand-nginx/config/apps/sys/dashboard.conf touch /var/lib/ondemand-nginx/config/apps/sys/shell.conf touch /var/lib/ondemand-nginx/config/apps/sys/myjobs.conf +# ood-portal.conf cannot be in package rules to avoid +# a prompt when changed during postinst +touch /etc/apache2/sites-available/ood-portal.conf touch /etc/ood/config/ood_portal.sha256sum /opt/ood/nginx_stage/sbin/update_nginx_stage @@ -15,15 +18,15 @@ touch /var/www/ood/apps/sys/dashboard/tmp/restart.txt touch /var/www/ood/apps/sys/shell/tmp/restart.txt touch /var/www/ood/apps/sys/myjobs/tmp/restart.txt -cd /etc/apache2/conf-enabled || exit 1 -ln -sf ../conf-available/ood-portal.conf . || true +cd /etc/apache2/sites-enabled || exit 1 +ln -sf /etc/apache2/sites-available/ood-portal.conf . || true cd /etc/apache2/mods-enabled || exit 1 -ln -sf ../mods-available/rewrite.load . || true -ln -sf ../mods-available/lua.load . || true -ln -sf ../mods-available/headers.load . || true -ln -sf ../mods-available/proxy.load . || true -ln -sf ../mods-available/proxy_http.load . || true +ln -sf /etc/apache2/mods-available/rewrite.load . || true +ln -sf /etc/apache2/mods-available/lua.load . || true +ln -sf /etc/apache2/mods-available/headers.load . || true +ln -sf /etc/apache2/mods-available/proxy.load . || true +ln -sf /etc/apache2/mods-available/proxy_http.load . || true # shellcheck disable=SC1091 [ -e /etc/apache2/envvars ] && . /etc/apache2/envvars diff --git a/packaging/deb/postrm b/packaging/deb/postrm index 9dc502518e..07390286b9 100755 --- a/packaging/deb/postrm +++ b/packaging/deb/postrm @@ -4,8 +4,9 @@ if [[ "$1" == "remove" || "$1" == "purge" ]]; then rm -rf /var/tmp/ondemand-nginx &>/dev/null || true rm -rf /var/run/ondemand-ngin &>/dev/null || true - unlink /etc/apache2/conf-enabled/ood-portal.conf &>/dev/null || true - unlink /etc/apache2/conf-available/ood-portal.conf &>/dev/null || true + unlink /etc/apache2/sites-enabled/ood-portal.conf &>/dev/null || true + unlink /etc/apache2/sites-available/ood-portal.conf &>/dev/null || true + unlink /etc/ood/config/ood_portal.sha256sum &>/dev/null || true unlink /etc/systemd/system/apache2.service.d/ood.conf &>/dev/null || true unlink /etc/systemd/system/apache2.service.d/ood-portal.conf &>/dev/null || true