From 01cb2d675103283664e0a870818cfc413f546b37 Mon Sep 17 00:00:00 2001 From: Rafael Laboissiere Date: Sat, 9 May 2015 10:42:34 +0200 Subject: Initial commit --- add-git-user | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 add-git-user (limited to 'add-git-user') diff --git a/add-git-user b/add-git-user new file mode 100755 index 0000000..1f5eec1 --- /dev/null +++ b/add-git-user @@ -0,0 +1,75 @@ +#!/bin/sh + +### Add a Git user to the system + +### Copyright (C) 2015 Rafael Laboissiere +### +### 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=$(tempfile) + +### Cleanup function +cleanup(){ + rm -f $tmp +} +trap "cleanup" 1 2 3 13 15 + +### Create the temporary configuration file +home=/var/git +cat > $tmp < $nolog <