post_install() {
	if ! getent group partimag &>/dev/null; then
		groupadd -g 110 partimag >/dev/null
	fi
	if ! getent passwd partimag &>/dev/null; then
		useradd -u 110 -g partimag -G adm -c "Partimage user" -d /dev/null -s /bin/nologin partimag >/dev/null
	fi
	if ! groups partimag | grep adm &>/dev/null; then
		gpasswd -a partimag adm >/dev/null
	fi
	partimag_shell=$(getent passwd partimag | cut -d: -f7)
	if [ "$partimag_shell" != '/bin/nologin' ]; then
		chsh -s /bin/nologin partimag &>/dev/null
	fi
}

post_upgrade() {
	post_install
}

post_remove() {
	if getent passwd partimag &>/dev/null; then
		userdel partimag >/dev/null
	fi
	if getent group partimag &>/dev/null; then
		groupdel partimag >/dev/null
	fi
}
