#!/bin/sh

# Abort if any command returns an error value
set -e

if [ "@GROUP@" != "root" ]; then
    groupadd -f "@GROUP@"
fi

if [ "@USER@" != "root" ]; then
    useradd -d "$(dirname @PID_FILE@)" -M -N -G "@GROUP@" "@USER@"
fi

if [ -f "/etc/init.d/centengine" ]; then
    update-rc.d centengine defaults
fi

exit 0
