freebsd-ports/devel/py-gitosis/pkg-install
Nicola Vitale c6a66aa044 Manage git repositories, provide access to them over SSH, with tight
access control and not needing shell accounts.

Gitosis aims to make hosting git repos easier and safer. It manages
multiple repositories under one user account, using SSH keys to
identify users. End users do not need shell accounts on the server,
they will talk to one shared account that will not let them run
arbitrary commands.

WWW: http://eagain.net/gitweb/?p=gitosis.git

PR:		ports/136083
Submitted by:	Douglas Thrift <douglas at douglasthrift.net>
2009-09-15 08:23:25 +00:00

43 lines
918 B
Bash

#!/bin/sh
# $FreeBSD$
PATH=/bin:/usr/bin:/usr/sbin
case $2 in
PRE-INSTALL)
GITUSER=${GITUSER:-git}
GITGROUP=${GITGROUP:-git}
GITHOME=${GITHOME:-${PKG_PREFIX}/${GITUSER}}
UID=211
GID=211
if pw group show "${GITGROUP}" 2>/dev/null; then
echo "You already have a group \"${GITGROUP}\", so I will use it."
else
if pw groupadd ${GITGROUP} -g ${GID}; then
echo "Added group \"${GITGROUP}\"."
else
echo "Adding group \"${GITGROUP}\" failed..."
exit 1
fi
fi
if pw user show "${GITUSER}" 2>/dev/null; then
echo "You already have a user \"${GITUSER}\", so I will use it."
else
if pw useradd ${GITUSER} -u ${UID} -g ${GITGROUP} -h - -d ${GITHOME} \
-c "gitosis user"
then
echo "Added user \"${GITUSER}\"."
else
echo "Adding user \"${GITUSER}\" failed..."
exit 1
fi
fi
if ! [ -x ~${GITUSER} ] ; then
install -m 755 -o ${GITUSER} -g ${GITGROUP} -d ${GITHOME}
fi
;;
esac