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,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") 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!"
if [ -z ${DELETEIT} ] ; then
while true; do while true; do
read -p "Do you wish to delete it and continue?(y/n) " yn read -p "Do you wish to delete it and continue?(y/n) " yn
case $yn in case $yn in
@ -126,7 +127,9 @@ if [ "$RESPONSE" == "200" ]; then
* ) 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)