#!/bin/bash # # git-edit-readme.sh # # Edit the README.md for an smeserver package and alter the Bugzilla link # # $1 = package name ORG=smecontribs # or smeserver echo "$ORG / $1" cd ~/GITFiles/$ORG if [ -d "$1" ]; then cd "$1" git pull else git clone "https://src.koozali.org/$ORG/$1" cd "$1" fi echo "Current directory: `pwd`" if [ -f "README.md" ]; then echo "Running awk to update README.md" # Use a temporary file to handle multi-line replacement awk '/Show list of outstanding bugs: \[here\]/{ print "Show list of outstanding bugs:" print "[All](https://bugs.koozali.org/buglist.cgi?action=wrap" \ "&bug_status=UNCONFIRMED&bug_status=CONFIRMED" \ "&bug_status=NEEDINFO&bug_status=IN_PROGRESS" \ "&bug_status=RESOLVED&bug_status=VERIFIED" \ "&classification=Contribs&component='"$1"'&list_id=105781" \ "&order=changeddate+DESC%2Ccomponent%2Cpriority" \ "%2Cbug_severity&product=SME+Contribs&query_format=advanced) " print "[Confirmed](https://bugs.koozali.org/buglist.cgi?action=wrap" \ "&bug_status=CONFIRMED&classification=Contribs&component='"$1"'" \ "&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \ "%2Cbug_severity&product=SME+Contribs&query_format=advanced) " print "[Unconfirmed](https://bugs.koozali.org/buglist.cgi?action=wrap" \ "&bug_status=UNCONFIRMED&classification=Contribs&component='"$1"'" \ "&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \ "%2Cbug_severity&product=SME+Contribs&query_format=advanced) " print "[Need Info](https://bugs.koozali.org/buglist.cgi?action=wrap" \ "&bug_status=NEEDINFO&classification=Contribs&component='"$1"'" \ "&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \ "%2Cbug_severity&product=SME+Contribs&query_format=advanced) " print "[In Progress](https://bugs.koozali.org/buglist.cgi?action=wrap" \ "&bug_status=IN_PROGRESS&classification=Contribs&component='"$1"'" \ "&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \ "%2Cbug_severity&product=SME+Contribs&query_format=advanced) " print "[Verified](https://bugs.koozali.org/buglist.cgi?action=wrap" \ "&bug_status=VERIFIED&classification=Contribs&component='"$1"'" \ "&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \ "%2Cbug_severity&product=SME+Contribs&query_format=advanced) " print "[Resolved](https://bugs.koozali.org/buglist.cgi?action=wrap" \ "&bug_status=RESOLVED&classification=Contribs&component='"$1"'" \ "&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \ "%2Cbug_severity&product=SME+Contribs&query_format=advanced) " next }1' README.md > README.tmp && mv README.tmp README.md git status git add --all git commit -m "Update README with specific Bugzilla links" git push else echo "README.md not found in $1" fi