#!/bin/bash # # Copyright (C) 2002 Vivek Venugopalan. All Rights Reserved. # # This 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 2 of the License, or # (at your option) any later version. # # This software 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 software; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, # USA. # # This script disables a restricted user to the CVSPermissions database. cleanup () { if [ -d CVSROOT ];then rm -rf CVSROOT fi rm -f users.list } printusage () { echo "Usage : $0 [ -d | -e ] <`uname -s` user name(s)>" } if [ $# -lt 2 ];then printusage; exit 1; fi echo checking out CVSROOT module for the repository. cvs co CVSROOT >/dev/null if [ $? -eq 1 ];then echo Could not access the CVSROOT module. Exiting! exit 1; fi FILETOADD= FILETODEL= case "$1" in --enable | -e) FILETOADD="writers"; FILETODEL="readers"; break;; --disable | -d) FILETOADD="readers"; FILETODEL="writers"; break;; --help | -? | -h | --h*) printusage; cleanup; exit 1;; esac shift #Get all the names in a file while $# -ne 0 ;do echo $1 >> users.list done #Remove from $FILETODEL file and add to $FILETOADD file grep -vf users.list CVSROOT/$FILETODEL > CVSROOT/$FILETODEL.new mv CVSROOT/$FILETODEL.new CVSROOT/$FILETODEL #Clean up $FILETOADD during the process. grep -vf users.list CVSROOT/$FILETOADD > CVSROOT/$FILETOADD.new mv CVSROOT/$FILETOADD CVSROOT/$FILETOADD #Add to readers cat users.list >> CVSROOT/$FILETOADD echo "Commiting to the repository..." cvs commit -m "Disabled users" CVSROOT >/dev/null 2>&1 if [ $? -ne 0 ];then echo Commit to the repository failed. Please try after sometime. fi cleanup exit 0