#!/bin/sh
# Handling users:  Have to modify /etc/sshd_config with::
# This makes it normal for users whose home directory is in /home/.  For the
# vcsusers, this places their keys outside of the repository structure.
# authorizedKeyFile /home/%u/.ssh/authorized_keys

REPODIR=/pkgs/bzr/chroot//pkgs

if [ x$2 != "x" ]; then
	groupFlag="--groups $2"
else
	groupFlag=''
fi

useradd $1  --home $REPODIR --gid vcsuser -M -n -s /usr/sbin/scponlyc $groupFlag

# Copy ssh key to /home/
mkdir -p /home/$1/.ssh
chown $1:$1 /home/$1/.ssh
### FIXME: Retrieve key and copy to the directory
chmod 0444 /home/$1/.ssh/*
chmod -R 0555 /home/$1

