Skip to content

Commit 95ef3c1

Browse files
authored
Merge pull request #19 from Al-Muhandis/codex/create-/var/log/tgadmin-directory
Ensure tgadmin runtime log and data dirs are created in postinst
2 parents a0c9bbb + 3dc965e commit 95ef3c1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

debian/DEBIAN/postinst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ SCHEMA_FILE="/usr/share/${PACKAGE_NAME}/db_schema.sql"
77
DEFAULTS_FILE="/etc/default/${PACKAGE_NAME}"
88
SYSTEMD_DROPIN_DIR="/etc/systemd/system/${PACKAGE_NAME}.service.d"
99
SYSTEMD_DROPIN_FILE="${SYSTEMD_DROPIN_DIR}/10-run-as.conf"
10+
LOG_DIR="/var/log/${PACKAGE_NAME}"
11+
DATA_DIR="/var/lib/${PACKAGE_NAME}"
1012

1113
DB_NAME="tgadmin"
1214
DB_USER="tgadmin"
@@ -88,6 +90,11 @@ DROPIN
8890
systemctl daemon-reload || true
8991
}
9092

93+
ensure_runtime_directories() {
94+
install -d -m 0750 -o "${SERVICE_USER}" -g "${SERVICE_GROUP}" "${LOG_DIR}"
95+
install -d -m 0750 -o "${SERVICE_USER}" -g "${SERVICE_GROUP}" "${DATA_DIR}"
96+
}
97+
9198
case "$1" in
9299
configure)
93100
# ----------------------------------------------------------------
@@ -115,6 +122,7 @@ case "$1" in
115122

116123
resolve_service_identity
117124
ensure_service_account
125+
ensure_runtime_directories
118126
configure_systemd_service_user
119127

120128
# ----------------------------------------------------------------

0 commit comments

Comments
 (0)