The install script creates and initializes that directory only if the "hg" user doesn't exist. Otherwise it assumes you have an existing setup it should use. Try adding these deluser
and delgroup
commands to what you're doing:
apt-get purge mercurial-server
deluser --remove-home --system hg
delgroup --system hg
rm -rf /var/lib/mercurial-server
apt-get update
apt-get install mercurial mercurial-server
Alternately, before the "purge", do "dpkg-reconfigure mercurial-server" and set the option that destroys all data.
I'll detect and fix this in a future revision - thanks for reporting it!