diff options
| author | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
|---|---|---|
| committer | stephanchrst <stephanchrst@gmail.com> | 2022-05-10 21:51:50 +0700 |
| commit | 3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch) | |
| tree | a44932296ef4a9b71d5f010906253d8c53727726 /debian/postinst | |
| parent | 0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff) | |
initial commit 2
Diffstat (limited to 'debian/postinst')
| -rw-r--r-- | debian/postinst | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 00000000..342fa4e1 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e + +ODOO_CONFIGURATION_FILE=/etc/odoo/odoo.conf +ODOO_GROUP="odoo" +ODOO_DATA_DIR=/var/lib/odoo +ODOO_LOG_DIR=/var/log/odoo +ODOO_USER="odoo" + +case "${1}" in + configure) + if ! getent passwd | grep -q "^odoo:"; then + adduser --system --home $ODOO_DATA_DIR --quiet --group $ODOO_USER + fi + # Register "$ODOO_USER" as a postgres user with "Create DB" role attribute + su - postgres -c "createuser -d -R -S $ODOO_USER" 2> /dev/null || true + # Configuration file + chown $ODOO_USER:$ODOO_GROUP $ODOO_CONFIGURATION_FILE + chmod 0640 $ODOO_CONFIGURATION_FILE + # Log + mkdir -p $ODOO_LOG_DIR + chown $ODOO_USER:$ODOO_GROUP $ODOO_LOG_DIR + chmod 0750 $ODOO_LOG_DIR + # Data dir + chown $ODOO_USER:$ODOO_GROUP $ODOO_DATA_DIR + ;; + *) + ;; +esac + +#DEBHELPER# + +exit 0 |
