|
| 1 | +#!/bin/sh |
| 2 | +set -e |
| 3 | +set -x |
| 4 | + |
| 5 | + |
| 6 | +. /usr/share/debconf/confmodule |
| 7 | + |
| 8 | +db_version 2.0 |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +case "$1" in |
| 15 | + configure) |
| 16 | + |
| 17 | + |
| 18 | + if [ -f /usr/share/dbconfig-common/dpkg/postinst ]; then |
| 19 | + . /usr/share/dbconfig-common/dpkg/postinst |
| 20 | + # shellcheck disable=SC2034 |
| 21 | + dbc_generate_include_args="-U -o template_infile=/usr/lib/cnb-cache/.env.template" |
| 22 | + # shellcheck disable=SC2034 |
| 23 | + dbc_generate_include=template:/etc/cnb-cache/cnb-cache.env |
| 24 | + # shellcheck disable=SC2034 |
| 25 | + dbc_generate_include_owner="root:www-data" |
| 26 | + # shellcheck disable=SC2034 |
| 27 | + dbc_generate_include_perms="664" |
| 28 | + # shellcheck disable=SC2034 |
| 29 | + dbc_dbfile_owner="www-data:www-data" |
| 30 | + # shellcheck disable=SC2034 |
| 31 | + dbc_dbfile_perms="0664" |
| 32 | + # shellcheck disable=SC2034 |
| 33 | + dbc_dbuser=cnb-cache |
| 34 | + # shellcheck disable=SC2034 |
| 35 | + dbc_dbname=cnb-cache |
| 36 | + |
| 37 | + dbc_go cnb-cache-sqlite "$@" |
| 38 | + |
| 39 | + echo "############################" |
| 40 | + cat /etc/cnb-cache/cnb-cache.env |
| 41 | + echo "############################" |
| 42 | + |
| 43 | + phinx migrate -c /usr/lib/cnb-cache/phinx-adapter.php |
| 44 | + |
| 45 | + if [ -f /var/lib/cnb-cache/cnb-cache ]; then |
| 46 | + chown root:www-data /var/lib/cnb-cache |
| 47 | + chmod ug+rw /var/lib/cnb-cache |
| 48 | + fi |
| 49 | + |
| 50 | + fi |
| 51 | + |
| 52 | + |
| 53 | + ;; |
| 54 | + |
| 55 | + abort-upgrade|abort-remove|abort-deconfigure) |
| 56 | + ;; |
| 57 | + |
| 58 | + *) |
| 59 | + echo "postinst called with unknown argument \`$1'" >&2 |
| 60 | + exit 1 |
| 61 | + ;; |
| 62 | +esac |
| 63 | + |
| 64 | + |
| 65 | +#DEBHELPER# |
| 66 | + |
| 67 | +exit 0 |
0 commit comments