fix delete override

This commit is contained in:
Trevor Batley 2023-06-01 09:41:09 +10:00
parent db6884d245
commit 5a13da4d58

View File

@ -85,7 +85,7 @@ for param in $2 $3 $4 $5; do
SOURCEACCESSTOKEN=${local_GITEAACCESSTOKEN} SOURCEACCESSTOKEN=${local_GITEAACCESSTOKEN}
TARGETORG=${local_USER} ;; TARGETORG=${local_USER} ;;
force ) force )
DELETIT=true ;; DELETEIT=true ;;
debug ) debug )
DEBUG=true ;; 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") RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
echo "Repository for $TARGETORG/$TARGETPKG exists!" echo "Repository for $TARGETORG/$TARGETPKG exists!"
while true; do if [ -z ${DELETEIT} ] ; then
read -p "Do you wish to delete it and continue?(y/n) " yn while true; do
case $yn in read -p "Do you wish to delete it and continue?(y/n) " yn
[Yy]* ) case $yn in
[Yy]* )
DELETEIT=true DELETEIT=true
break ;; break ;;
[Nn]* ) [Nn]* )
echo "************Abandoning Fork of $SOURCEORG/$SOURCEPKG on $SOURCEHOST ($RESPONSE)" echo "************Abandoning Fork of $SOURCEORG/$SOURCEPKG on $SOURCEHOST ($RESPONSE)"
exit 1 ;; exit 1 ;;
* ) echo "Please answer yes or no.";; * ) echo "Please answer yes or no.";;
esac esac
done done
fi
if [ $DELETEIT ] ; then if [ $DELETEIT ] ; then
if [ $DEBUG ] ; then echo "Deleting $TARGETORG/$TARGETPKG" ; fi
RESPONSE=$(curl "$checkSSL" "$SILENT" -X 'DELETE' \ RESPONSE=$(curl "$checkSSL" "$SILENT" -X 'DELETE' \
"$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \ "$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
-H 'accept: application/json' \ -H 'accept: application/json' \
@ -217,7 +220,7 @@ fi
# Clone the package # Clone the package
if [ $DEBUG ] ; then echo "git clone $SOURCEHOST/$TARGETORG/$TARGETPKG.git" ; fi if [ $DEBUG ] ; then echo "git clone $SOURCEHOST/$TARGETORG/$TARGETPKG.git" ; fi
cd $GITFiles cd $GITFiles
git clone "$SOURCEHOST/$TARGETORG/$TARGETPKG.git" git clone "$SOURCEHOST/$TARGETORG/$TARGETPKG.git" $QUIET
cd $GITFiles/$TARGETPKG cd $GITFiles/$TARGETPKG
#Update README.md #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/{ n; s/smeserver-/e-smith-/g}' README.md
sed -i '/Show list/ s/)/)\\/' README.md sed -i '/Show list/ s/)/)\\/' README.md
git add README.md git add README.md $QUIET
#Update Makefile #Update Makefile
# - NAME := smeserver-<pkg> # - NAME := smeserver-<pkg>
sed -i 's/e-smith/smeserver/g' Makefile sed -i 's/e-smith/smeserver/g' Makefile
git add Makefile git add Makefile $QUIET
# spec file # spec file
#Rename e-smith-<pkg>.spec as smeserver-<pkg>.spec #Rename e-smith-<pkg>.spec as smeserver-<pkg>.spec
@ -264,16 +267,16 @@ sed -i "/%description/i Provides: $SOURCEPKG" "$TARGETPKG.spec"
sed -i "s/tar.xz/tar.gz/" "$TARGETPKG.spec" sed -i "s/tar.xz/tar.gz/" "$TARGETPKG.spec"
# tell git about the changes # tell git about the changes
git rm "$SOURCEPKG.spec" git rm "$SOURCEPKG.spec" $QUIET
git add "$TARGETPKG.spec" git add "$TARGETPKG.spec" $QUIET
#Delete archivefilename file if it follows the new standard #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 #Update createlinks
# - if there is an e-smith-<pkg>-update event rename to smeserver-<pkg>-update and add symlink # - if there is an e-smith-<pkg>-update event rename to smeserver-<pkg>-update and add symlink
git commit -m "rename-e-smith-pkg script (#12359)" git commit -m "rename-e-smith-pkg script (#12359)" $QUIET
git push origin master git push origin master $QUIET
#Convert repository to a Regular Repository (rather than fork) #Convert repository to a Regular Repository (rather than fork)