diff options
author | Holger Levsen <holger@layer-acht.org> | 2014-10-26 00:14:19 +0200 |
---|---|---|
committer | Holger Levsen <holger@layer-acht.org> | 2014-10-26 00:17:37 +0200 |
commit | f82aa51adf4ea5317ef37669319bc9651692e738 (patch) | |
tree | 9602abe1fc6447c81855b99fee4c4d909205701c /bin/common-functions.sh | |
parent | 921eb96288d6240076b8d4b9cb735e4cf76deaf0 (diff) | |
download | jenkins.debian.net-f82aa51adf4ea5317ef37669319bc9651692e738.tar.xz |
refactor code into new publish_changes_to_userContent()
This new function is used to publish both the Debian Edu manuals as well
as the Debian Installer installation-guide to
https://jenkins.debian.net/userContent/debian-edu-doc/ and
https://jenkins.debian.net/userContent/installation-guide/
Diffstat (limited to 'bin/common-functions.sh')
-rwxr-xr-x | bin/common-functions.sh | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/bin/common-functions.sh b/bin/common-functions.sh index c68d4170..b8631473 100755 --- a/bin/common-functions.sh +++ b/bin/common-functions.sh @@ -69,3 +69,37 @@ else fi } +publish_changes_to_userContent(){ + echo "Extracting contents from .deb files..." + CHANGES=$1 + CHANNEL=$2 + SRCPKG=$(basename $CHANGES | cut -d "_" -f1) + if [ -z "$SRCPKG" ] ; then + exit 1 + fi + VERSION=$(basename $CHANGES | cut -d "_" -f2) + TARGET="/var/lib/jenkins/userContent/$SRCPKG" + NEW_CONTENT=$(mktemp -d) + for DEB in $(dcmd --deb $CHANGES) ; do + dpkg --extract $DEB ${NEW_CONTENT} 2>/dev/null + done + rm -rf $TARGET + mkdir $TARGET + mv ${NEW_CONTENT}/usr/share/doc/${SRCPKG}-* $TARGET/ + rm -r ${NEW_CONTENT} + if [ -z "$3" ] ; then + touch "$TARGET/${VERSION}" + FROM="" + else + touch "$TARGET/${VERSION}_$3" + FROM=" from $3" + fi + MESSAGE="https://jenkins.debian.net/userContent/$SRCPKG/ has been updated${FROM}." + echo + echo $MESSAGE + echo + if [ ! -z "$CHANNEL" ] ; then + kgb-client --conf /srv/jenkins/kgb/$CHANNEL.conf --relay-msg "$MESSAGE" + fi +} + |