Skip to content

Commit f6aa5ec

Browse files
committed
[FIX] packaging: fix installing deb package when user exists
When a odoo user already exists, the installation of the deb package fails because the `/var/lib/odoo` directory does not exists. The reason is that the postinst script is trying to change the permissions of this directory which is only created if a odoo user does not already exists. With this commit, the permission changes only occurs when the directory is created. closes odoo#111846 X-original-commit: 8e1ebd8 Signed-off-by: Christophe Monniez (moc) <moc@odoo.com>
1 parent e711fb5 commit f6aa5ec

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

debian/postinst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ case "${1}" in
1212
configure)
1313
if ! getent passwd | grep -q "^odoo:"; then
1414
adduser --system --home $ODOO_DATA_DIR --quiet --group $ODOO_USER
15+
# Data dir
16+
chown $ODOO_USER:$ODOO_GROUP $ODOO_DATA_DIR
1517
fi
1618
# Register "$ODOO_USER" as a postgres user with "Create DB" role attribute
1719
su - postgres -c "createuser -d -R -S $ODOO_USER" 2> /dev/null || true
@@ -22,8 +24,6 @@ case "${1}" in
2224
mkdir -p $ODOO_LOG_DIR
2325
chown $ODOO_USER:$ODOO_GROUP $ODOO_LOG_DIR
2426
chmod 0750 $ODOO_LOG_DIR
25-
# Data dir
26-
chown $ODOO_USER:$ODOO_GROUP $ODOO_DATA_DIR
2727
;;
2828
*)
2929
;;

0 commit comments

Comments
 (0)