Skip to content

Commit 12d1572

Browse files
committed
create directory for database file first
1 parent 0ae02d4 commit 12d1572

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

debian/cnb-cache-sqlite.postinst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ configure)
1717
# shellcheck disable=SC2034
1818
dbc_generate_include=template:/etc/cnb-cache/cnb-cache.env
1919
# shellcheck disable=SC2034
20-
dbc_generate_include_owner="root:www-data"
20+
dbc_generate_include_owner="root:cnb-cache"
2121
# shellcheck disable=SC2034
2222
dbc_generate_include_perms="664"
2323
# shellcheck disable=SC2034
24-
dbc_dbfile_owner="www-data:www-data"
24+
dbc_dbfile_owner="cnb-cache:cnb-cache"
2525
# shellcheck disable=SC2034
2626
dbc_dbfile_perms="0664"
2727
# shellcheck disable=SC2034
@@ -35,6 +35,11 @@ configure)
3535
cat /etc/cnb-cache/cnb-cache.env
3636
echo "############################"
3737

38+
if [ ! -d /var/lib/dbconfig-common/sqlite3/cnb-cache ]; then
39+
mkdir -p /var/lib/dbconfig-common/sqlite3/cnb-cache
40+
chown cnb-cache:cnb-cache /var/lib/dbconfig-common/sqlite3/cnb-cache
41+
fi
42+
3843
if [ ! -f /var/lib/dbconfig-common/sqlite3/cnb-cache/cnb-cache ]; then
3944
install -o cnb-cache -g cnb-cache -m 0644 /dev/null /var/lib/dbconfig-common/sqlite3/cnb-cache/cnb-cache
4045
fi
@@ -43,7 +48,7 @@ configure)
4348
phinx migrate -c /usr/lib/cnb-cache/phinx-adapter.php
4449

4550
if [ -f /var/lib/cnb-cache/cnb-cache ]; then
46-
chown root:www-data /var/lib/cnb-cache
51+
chown root:cnb-cache /var/lib/cnb-cache
4752
chmod ug+rw /var/lib/cnb-cache
4853
fi
4954

0 commit comments

Comments
 (0)