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}
TARGETORG=${local_USER} ;;
force )
DELETIT=true ;;
DELETEIT=true ;;
debug )
DEBUG=true ;;
* )
@ -114,6 +114,7 @@ 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!"
if [ -z ${DELETEIT} ] ; then
while true; do
read -p "Do you wish to delete it and continue?(y/n) " yn
case $yn in
@ -126,7 +127,9 @@ if [ "$RESPONSE" == "200" ]; then
* ) 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-<pkg>
sed -i 's/e-smith/smeserver/g' Makefile
git add Makefile
git add Makefile $QUIET
# spec file
#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"
# 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-<pkg>-update event rename to smeserver-<pkg>-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)