Skip to content

Commit

Permalink
Numerous fixes for deb package (#1576)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
treydock authored Nov 6, 2021
1 parent 40f9ab2 commit 2e96287
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion ood-portal-generator/spec/application_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 10 additions & 7 deletions packaging/deb/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
5 changes: 3 additions & 2 deletions packaging/deb/postrm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2e96287

Please sign in to comment.