cant rm whilst in the directory...

This commit is contained in:
Trevor Batley 2023-06-06 20:19:09 +10:00
parent 5861b6af76
commit 5207676ada

View File

@ -100,11 +100,13 @@ if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME exists!" ; fi if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME exists!" ; fi
else else
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME does not exist" ; fi if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME does not exist" ; fi
logname="git-cvs2git-create-$ORG_NAME-$REPO_NAME-$(date +'%FT%H%M').log"
while true; do while true; do
read -p "Do you wish to run git-cvs2git?(y/n) " yn read -p "Do you wish to run git-cvs2git?(y/n) " yn
case $yn in case $yn in
[Yy]* ) git-cvs2git.sh "$REPO_NAME" "$ORG_NAME" > $logname; break;; [Yy]* )
logname="git-cvs2git-create-$ORG_NAME-$REPO_NAME-$(date +'%FT%H%M').log"
git-cvs2git.sh "$REPO_NAME" "$ORG_NAME" > $logname
break;;
[Nn]* ) exit;; [Nn]* ) exit;;
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
@ -120,20 +122,17 @@ else
fi fi
# Ok, we have a repo!! # Ok, we have a repo!!
cd $GITFiles cd $GITFiles
echo $GITFiles if [ $DEBUG ] ; then echo $GITFiles ; fi
# Delete it if these already # Delete it if these already
if [[ -d $REPO_NAME ]] ; then if [[ -d $REPO_NAME ]] ; then
# Should delete everything.... # Should delete everything....
cd $GITFiles/$REPO_NAME
if [ $DEBUG ] ; then echo "Deleting all files in $GITFiles/$REPO_NAME" ; fi if [ $DEBUG ] ; then echo "Deleting all files in $GITFiles/$REPO_NAME" ; fi
rm -rf "$REPO_NAME" rm -rf "$GITFiles/$REPO_NAME"
fi fi
cd $GITFiles
git clone "$REPOURL" $QUIET git clone "$REPOURL" $QUIET
cd $GITFiles cd $GITFiles
if [[ ! -d $REPO_NAME ]] ; then if [[ ! -d $GITFiles/$REPO_NAME ]] ; then
echo "git clone has not created the $REPO_NAME directory" echo "git clone has not created the $REPO_NAME directory"
exit 1 exit 1
fi fi