# Don't fail if the user/database already exists
su postgres -c 'createuser invirt -S -d -R' || true
su postgres -c 'createdb invirt -O invirt' || true
- adduser --system invirt
fi
+
+ # The invirt user *must* exist
+ if ! getent passwd invirt >/dev/null 2>&1; then
+ adduser --system invirt
+ fi
invoke-rc.d postgresql-8.3 restart
su invirt -s /bin/sh -c 'invirt-database-tables create'
;;