diff --git a/scripts/gitlab.sh b/scripts/gitlab.sh index 08258b0..4bb101a 100755 --- a/scripts/gitlab.sh +++ b/scripts/gitlab.sh @@ -1,13 +1,11 @@ #!/bin/bash DATABASE_HOST=$1 -THIS_HOST=$2 -if [[ ! "$DATABASE_HOST" || ! "$THIS_HOST" ]] - then - echo " Parametros nao encontrados." - echo " ./mailman.sh " - exit -1 +if [[ ! "$DATABASE_HOST" ]] + then + echo "Uso: ./gitlab.sh " + exit -1 fi [ -s "$HOME/.rvm/scripts/rvm" ] && . "$HOME/.rvm/scripts/rvm" diff --git a/scripts/users.sh b/scripts/users.sh new file mode 100644 index 0000000..e9e8408 --- /dev/null +++ b/scripts/users.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +# Make sure to create user colab and colabdev group +COLAB_USER=colab +COLAB_GROUP=colabdev + +# Get user and group +COLAB_USER_EXISTS=`cat /etc/group | grep $COLAB_USER:` +COLAB_GROUP_EXISTS=`cat /etc/group | grep $COLAB_GROUP:` + +# Errors +ERROR_NOT_ALLOWED=126 +ERROR_ALREADY_EXIST=9 + +# Make sure colab user exist +if [ -e $COLAB_USER_EXISTS ]; then + sudo adduser $COLAB_USER; + LAST_CMD=`echo $?` + if [ $LAST_CMD == $ERROR_NOT_ALLOWED ]; then + echo "You don't have permission to create users" + echo "Aborting installation" + exit -1 + fi +fi + +# Make sure colab group exist +if [ -e $COLAB_GROUP_EXISTS ]; then + sudo groupadd $COLAB_GROUP; + LAST_CMD=`echo $?` + if [ $LAST_CMD == $ERROR_NOT_ALLOWED ]; then + echo "You don't have permission to create groups" + echo "Aborting installation" + exit -1 + fi +fi + + -- libgit2 0.21.2