Sophie

Sophie

distrib > Mandriva > 9.2 > i586 > by-pkgid > 0b0b6834adf18951d60f091e0b8136bb > scriptlet

htdig-3.2.0-0.7mdk.i586.rpm

PREIN

/bin/sh
egrep "^htdig:" /etc/group >/dev/null
if [ $? = 1 ]; then
		echo "adding htdig group"
		groupadd -r htdig
fi
egrep "^htdig:" /etc/passwd >/dev/null
if [ $? = 1 ]; then
		echo "adding htdig user"
		useradd -r -g htdig -s "" -d /var/lib/htdig htdig 
fi
egrep "^htdig:.*/var/lib/htdig:" /etc/passwd   >/dev/null
if [ $? = 1 ]; then
		echo "updating htdig homedir"
		perl -pi -e "s,^(htdig:.*:)[^:]+(:[^:]*)$,\1/var/lib/htdig\2," /etc/passwd
fi

PREUN

/bin/sh
# we're uninstalling
if [ $1 = 0 ]; then
		egrep "^htdig:" /etc/passwd >/dev/null
		if [ $? = 0 ]; then
			echo "removing htdig user"
			userdel htdig # userdel seems to nuke the group too..
		fi

		egrep "^htdig:" /etc/group >/dev/null
		if [ $? = 0 ]; then
			echo "removing htdig group"
			groupdel htdig
		fi
fi