Create directory for helm overrides backup

Add a directory in /var/opt for postgres user to dump overrides backup
during upgrade activate.

This reproduces the original commit from CentOS:
a09f8a65 "Create directory for helm overrides backup"

In CentOS the directory used for backup was /opt/oidc-auth-apps.  As
this is read-only in Debian, this commit switches to use /var/opt
instead.

The package depends on postgresql-common for creation of postgres
user/group, and base-files for creation and setting permissions of
/var/opt.

Test plan:
PASS: Debian build, inspect package
PASS: Install and confirm directory perms, writability, persistence
PASS: bootstrap, configure, unlock

Story: 2009303
Task: 46677

Change-Id: I84fec3cfdeeadd0f3759fce1390bab6d1d65c76e
Signed-off-by: Michel Thebeau <Michel.Thebeau@windriver.com>
This commit is contained in:
Michel Thebeau 2022-10-31 17:08:46 -04:00 committed by Michel Thebeau
parent c8c34b69f3
commit 7a5258ce4e
4 changed files with 22 additions and 1 deletions

View File

@ -12,7 +12,7 @@ Homepage: https://www.starlingx.io
Package: stx-oidc-auth-helm
Section: libs
Architecture: any
Depends: ${misc:Depends}
Depends: ${misc:Depends}, postgresql-common, base-files
Description: StarlingX OIDC Authorization Helm Charts
This package contains helm charts for the OIDC authorization
application.

View File

@ -3,6 +3,7 @@
export ROOT = debian/tmp
export APP_FOLDER = $(ROOT)/usr/local/share/applications/helm
export BACKUP_FOLDER = $(ROOT)/var/opt/oidc-auth-apps
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export MAJOR = $(shell echo $(DEB_VERSION) | cut -f 1 -d '.')
@ -55,5 +56,6 @@ override_dh_auto_install:
# Install the app tar file.
install -d -m 755 $(APP_FOLDER)
install -p -D -m 755 $(APP_TARBALL) $(APP_FOLDER)
install -d -m 750 $(BACKUP_FOLDER)
override_dh_usrlocal:

View File

@ -1 +1,2 @@
usr/local/share/applications/helm/*
var/opt/oidc-auth-apps

View File

@ -0,0 +1,18 @@
#!/bin/sh
set -e
case "$1" in
configure)
chown postgres:postgres /var/opt/oidc-auth-apps
chmod 750 /var/opt/oidc-auth-apps
;;
*)
true
;;
esac
#DEBHELPER#
exit 0