#!/bin/sh
### Add a Git user to the system
### Copyright (C) 2015, 2022 Rafael Laboissière
###
### This program is free software; you can redistribute it and/or modify it under
### the terms of the GNU General Public License as published by the Free Software
### Foundation; either version 3 of the License, or (at your option) any later
### version.
###
### This program is distributed in the hope that it will be useful, but WITHOUT
### ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
### FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
### details.
###
### You should have received a copy of the GNU General Public License along with
### this program; if not, see .
### Get the program name
prog=${0##*/}
### Ensure that at least one argument is given
if [ $# != 1 ] ; then
echo "Usage: $prog name" 1>&2
exit 1
fi
### Get the specified user name
user=$1
### Generate a temporary file with configuration for adduser
tmp=$(mktemp)
### Cleanup function
cleanup(){
rm -f $tmp
}
trap "cleanup" 1 2 3 13 15
### Create the temporary configuration file
home=/var/git
cat > $tmp < $nolog < $readonly <