Compare commits
No commits in common. "b97d611c791f9aad9d56b2635e2f470e5a7f56f3" and "040abb21e02c96bf4ec5e9008699a312d07274d6" have entirely different histories.
b97d611c79
...
040abb21e0
@ -1,126 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Fiddle with the newly created repo to fix things that cannot be done throug the gitea template
|
|
||||||
#
|
|
||||||
# $1 = Module name e.g. smeserver-null
|
|
||||||
# $2 = Organisation (smeserver or smecontrib)e
|
|
||||||
# $3 = "local" will use parameters set for local repository else it will use remote
|
|
||||||
#
|
|
||||||
if [[ -z $1 ]] ; then
|
|
||||||
echo "************git-post-create-repo.sh <modulename> <organization> [<local>]"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Pull in parameters from a config file ~/.smegit/config
|
|
||||||
#
|
|
||||||
inifilename=$(echo ~)"/.smegit/config"
|
|
||||||
if [ ! -e $inifilename ] ; then
|
|
||||||
# Not here, look at system default
|
|
||||||
if [ ! -e /etc/smegit.ini ] ; then
|
|
||||||
echo "No ini file found $inifiename or /etc/smegit.ini"
|
|
||||||
echo "*git-post-create-repo.sh <modulename> <organization> [<local>]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
initfilename="/etc/smegit.ini"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
while read -r line || [[ -n "$line" ]]; do
|
|
||||||
if [[ $line =~ ^\[.*\]$ ]]
|
|
||||||
then
|
|
||||||
section=${line#*[}
|
|
||||||
section=${section%]*}
|
|
||||||
else
|
|
||||||
if [[ $line =~ ^[^#]*= ]]
|
|
||||||
then
|
|
||||||
key=${line%=*}
|
|
||||||
value=${line#*=}
|
|
||||||
declare "${section}_${key}=$value"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done < "$inifilename"
|
|
||||||
|
|
||||||
LOCALUser=${local_USER}
|
|
||||||
if [[ $smegit_WORKDIR == ~* ]] ; then
|
|
||||||
# relative to users home dir
|
|
||||||
WORKDIR=$(echo ~)${smegit_WORKDIR:1}
|
|
||||||
else
|
|
||||||
# absolute path
|
|
||||||
WORKDIR=${smegit_WORKDIR}
|
|
||||||
fi
|
|
||||||
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
|
||||||
GITEAUser=$remote_USER
|
|
||||||
GITEAACCESSTOKEN=$remote_GITEAACCESSTOKEN
|
|
||||||
GITEAHOST=$remote_GITEAHOST
|
|
||||||
if [ $3 ] ; then
|
|
||||||
if [ "$3" == "local" ] ; then
|
|
||||||
GITEAUser=$local_USER
|
|
||||||
GITEAACCESSTOKEN=$local_GITEAACCESSTOKEN
|
|
||||||
GITEAHOST=$local_GITEAHOST
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
RemoteRepoURL="$GITEAHOST/$2/$1"
|
|
||||||
cd $WORKDIR/$2/$1
|
|
||||||
echo `pwd`
|
|
||||||
|
|
||||||
# Rename the spec file accordingly to $1
|
|
||||||
mv change-this-to-the-package-name.spec $1.spec
|
|
||||||
|
|
||||||
# Set the date in the spec file changelog to today
|
|
||||||
dateH=`date "+%a %b %d %Y"`
|
|
||||||
sed -i "s/Day MMMM DD YYYY/$dateH/" $1.spec
|
|
||||||
|
|
||||||
#Now write them all back to the repo
|
|
||||||
|
|
||||||
git add -A
|
|
||||||
git status
|
|
||||||
git commit -m "post create changes"
|
|
||||||
git push
|
|
||||||
|
|
||||||
# and fix up the external links to the Wiki and the Issues
|
|
||||||
# (this is a bug that I have logged) - they say is not supported.
|
|
||||||
|
|
||||||
TARGETPKG=$1
|
|
||||||
if [[ "$2" == "smecontribs" ]]; then
|
|
||||||
BASEORCONTRIB="contribs10"
|
|
||||||
PRODUCTBUGZILLA="SME%20Contribs"
|
|
||||||
else
|
|
||||||
BASEORCONTRIB="sme10"
|
|
||||||
PRODUCTBUGZILLA="SME%20Server%2010.X"
|
|
||||||
fi
|
|
||||||
TARGETORG=brianr
|
|
||||||
PRODUCTBUGZILLA=
|
|
||||||
WIKILINK="https://wiki.koozali.org"
|
|
||||||
RESPONSE=$(curl -X 'PATCH' \
|
|
||||||
"$GITEAHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H "Authorization: token $GITEAACCESSTOKEN" \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d '{
|
|
||||||
"description": "'"SMEServer Koozali developed repo for $TARGETPKG base"'",
|
|
||||||
"has_issues": true,
|
|
||||||
"external_tracker": {
|
|
||||||
"external_tracker_format": "https://bugs.koozali.org/show_bug.cgi?id={index}",
|
|
||||||
"external_tracker_style": "numeric",
|
|
||||||
"external_tracker_url": "'"https://bugs.koozali.org/buglist.cgi?component=$TARGETPKG&product=$PRODUCTBUGZILLA"'"
|
|
||||||
},
|
|
||||||
"has_wiki": true,
|
|
||||||
"external_wiki": {
|
|
||||||
"external_wiki_url": "'"$WIKILINK"'"
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
)
|
|
||||||
echo $RESPONSE
|
|
||||||
|
|
||||||
#That's All for now folks!!
|
|
||||||
exit 0
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user