tidy up DEBUG

This commit is contained in:
Trevor Batley 2023-05-11 15:29:55 +10:00
parent 4ef91afbf8
commit 0d8ca693a3

View File

@ -48,7 +48,7 @@ while read -r line || [[ -n "$line" ]]; do
fi fi
fi fi
done < "$inifilename" done < "$inifilename"
DEBUG=false DEBUG=
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
@ -57,7 +57,7 @@ QUIET="-q"
curlsilent="-s" curlsilent="-s"
if [ $DEBUG ] ; then if [ $DEBUG ] ; then
QUIET= QUIET=
curlsilent= curlsilent="-v"
fi fi
# Make this null to get curl to check ssl cert # Make this null to get curl to check ssl cert
checkSSL="-k" checkSSL="-k"
@ -142,14 +142,6 @@ cd $CVSFiles
# if there at all # if there at all
if [ -d "$1" ] ; then if [ -d "$1" ] ; then
if [ $DEBUG ] ; then echo "************Deleting local CVS files" ; fi if [ $DEBUG ] ; then echo "************Deleting local CVS files" ; fi
# cd $CVSFiles/$1
# Delete all files, links and directories
# find . -maxdepth 999 -xtype l -delete
# find . -maxdepth 999 -type f -delete
# we seem to need this as well
# find . -xtype l -exec rm -f {} +
# find . -maxdepth 999 -type d -delete
# cd $CVSFiles
rm -Rf $CVSFiles/$1 rm -Rf $CVSFiles/$1
fi fi
@ -219,25 +211,19 @@ cd $GITFiles
# Delete the local first # Delete the local first
if [ -d "$1" ] ; then if [ -d "$1" ] ; then
if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi
# cd $GITFiles/$1
# find . -maxdepth 999 -xtype l -delete
# find . -maxdepth 999 -type f -delete
# we seem to need this as well
# find . -xtype l -exec rm -f {} +
# find . -maxdepth 999 -type d -delete
# cd $GITFiles
# rmdir $1
rm -Rf $GITFiles/$1 rm -Rf $GITFiles/$1
fi fi
# See if it exists on the Gitea host # See if it exists on the Gitea host
REPO_NAME=$1 REPO_NAME=$1
RESPONSE=$(curl "$checkSSL" -s -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME") if [ $DEBUG ] ; then echo "curl $checkSSL $curlsilent -o /dev/null -w %{http_code} $GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME"
RESPONSE=$(curl $checkSSL $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi
# If so, clone it (just want the README.md) # If so, clone it (just want the README.md)
# And Clone it # And Clone it
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$1.git" ; fi
cd $GITFiles cd $GITFiles
git clone "$GITEAHOST/$ORGGITEA/$1.git" git clone "$GITEAHOST/$ORGGITEA/$1.git"
#GIT_SSL_NO_VERIFY=true git clone "$GITEAHOST/$ORGGITEA/$1.git" #GIT_SSL_NO_VERIFY=true git clone "$GITEAHOST/$ORGGITEA/$1.git"
@ -261,13 +247,7 @@ if [ -d "$1" ] ; then
if [ $DEBUG ] ; then echo "************Saved README: $READMECONTENTS" ; fi if [ $DEBUG ] ; then echo "************Saved README: $READMECONTENTS" ; fi
# Delete all files, links and directories # Delete all files, links and directories
if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi
# find . -maxdepth 999 -xtype l -delete
# find . -maxdepth 999 -type f -delete
# we seem to need this as well
# find . -xtype l -exec rm -f {} +
# find . -maxdepth 999 -type d -delete
cd $GITFiles cd $GITFiles
# rmdir $1
rm -Rf $GITFiles/$1 rm -Rf $GITFiles/$1
fi fi
@ -276,12 +256,14 @@ cd $GITFiles
#git init $QUIET $1 #git init $QUIET $1
# Now delete the remote repo and re-create it and clone it in to local # Now delete the remote repo and re-create it and clone it in to local
if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$1" ; fi
curl "$checkSSL" "$curlsilent" -X 'DELETE' \ curl "$checkSSL" "$curlsilent" -X 'DELETE' \
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \ "$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H "Authorization: token $GITEAACCESSTOKEN" -H "Authorization: token $GITEAACCESSTOKEN"
# and check if it is here. # and check if it is here.
if [ $DEBUG ] ; then echo "Check if $ORGGITEA/$1 is there!" ; fi
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1") RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "************Repository for $1 exists!" ; fi if [ $DEBUG ] ; then echo "************Repository for $1 exists!" ; fi