From 5a13da4d581c7ab101e896a07f11455f5c4815d3 Mon Sep 17 00:00:00 2001 From: Trevor Batley Date: Thu, 1 Jun 2023 09:41:09 +1000 Subject: [PATCH] fix delete override --- rename-e-smith-pkg.sh | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/rename-e-smith-pkg.sh b/rename-e-smith-pkg.sh index 11675d6..04c45a7 100755 --- a/rename-e-smith-pkg.sh +++ b/rename-e-smith-pkg.sh @@ -85,7 +85,7 @@ for param in $2 $3 $4 $5; do SOURCEACCESSTOKEN=${local_GITEAACCESSTOKEN} TARGETORG=${local_USER} ;; force ) - DELETIT=true ;; + DELETEIT=true ;; debug ) DEBUG=true ;; * ) @@ -114,19 +114,22 @@ if [ $DEBUG ] ; then echo "Check if $TARGETORG/$TARGETPKG is there!" ; fi RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG") if [ "$RESPONSE" == "200" ]; then echo "Repository for $TARGETORG/$TARGETPKG exists!" - while true; do - read -p "Do you wish to delete it and continue?(y/n) " yn - case $yn in - [Yy]* ) + if [ -z ${DELETEIT} ] ; then + while true; do + read -p "Do you wish to delete it and continue?(y/n) " yn + case $yn in + [Yy]* ) DELETEIT=true break ;; - [Nn]* ) + [Nn]* ) echo "************Abandoning Fork of $SOURCEORG/$SOURCEPKG on $SOURCEHOST ($RESPONSE)" exit 1 ;; - * ) echo "Please answer yes or no.";; - esac - done + * ) echo "Please answer yes or no.";; + esac + done + fi if [ $DELETEIT ] ; then + if [ $DEBUG ] ; then echo "Deleting $TARGETORG/$TARGETPKG" ; fi RESPONSE=$(curl "$checkSSL" "$SILENT" -X 'DELETE' \ "$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \ -H 'accept: application/json' \ @@ -217,7 +220,7 @@ fi # Clone the package if [ $DEBUG ] ; then echo "git clone $SOURCEHOST/$TARGETORG/$TARGETPKG.git" ; fi cd $GITFiles -git clone "$SOURCEHOST/$TARGETORG/$TARGETPKG.git" +git clone "$SOURCEHOST/$TARGETORG/$TARGETPKG.git" $QUIET cd $GITFiles/$TARGETPKG #Update README.md @@ -230,13 +233,13 @@ sed -i "/Show list/{ n; s/Show list of outstanding bugs\:/And a list of outstand sed -i '/Show list/{ n; s/smeserver-/e-smith-/g}' README.md sed -i '/Show list/ s/)/)\\/' README.md -git add README.md +git add README.md $QUIET #Update Makefile # - NAME := smeserver- sed -i 's/e-smith/smeserver/g' Makefile -git add Makefile +git add Makefile $QUIET # spec file #Rename e-smith-.spec as smeserver-.spec @@ -264,16 +267,16 @@ sed -i "/%description/i Provides: $SOURCEPKG" "$TARGETPKG.spec" sed -i "s/tar.xz/tar.gz/" "$TARGETPKG.spec" # tell git about the changes -git rm "$SOURCEPKG.spec" -git add "$TARGETPKG.spec" +git rm "$SOURCEPKG.spec" $QUIET +git add "$TARGETPKG.spec" $QUIET #Delete archivefilename file if it follows the new standard -if [ -e archivefilename ] ; then git rm archivefilename ; fi +if [ -e archivefilename ] ; then git rm archivefilename $QUIET ; fi #Update createlinks # - if there is an e-smith--update event rename to smeserver--update and add symlink -git commit -m "rename-e-smith-pkg script (#12359)" -git push origin master +git commit -m "rename-e-smith-pkg script (#12359)" $QUIET +git push origin master $QUIET #Convert repository to a Regular Repository (rather than fork)