summaryrefslogtreecommitdiff
path: root/publish-files
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-10-28 12:40:41 +0000
committerLars Wirzenius <liw@liw.fi>2012-10-28 12:40:41 +0000
commit41845c1733ca10f8c80adc46aef2ff9c508939e5 (patch)
tree72c338d780ee464924a143d2ac2b9dab0fdace65 /publish-files
parent5c34b3ba7993b7c7747a5b49d1009be8d50bc4ac (diff)
downloadjenkinstool-41845c1733ca10f8c80adc46aef2ff9c508939e5.tar.gz
Add script to publish documentstion files
Diffstat (limited to 'publish-files')
-rwxr-xr-xpublish-files50
1 files changed, 50 insertions, 0 deletions
diff --git a/publish-files b/publish-files
new file mode 100755
index 0000000..05ef674
--- /dev/null
+++ b/publish-files
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+set -eu
+
+wikidir="$HOME/liw.fi"
+markdown="README NEWS"
+
+publish_markdown()
+{
+ local tree="$1"
+ local name="$2"
+ shift 2
+ for filename in "$@"
+ do
+ find "$tree/usr/share/doc" -mindepth 2 -maxdepth 2 -name "$filename" |
+ while read pathname
+ do
+ echo cp "$pathname" "$wikidir/$name/$filename.mdwn"
+ done
+ done
+}
+
+publish_manpages()
+{
+ local tree="$1"
+ local name="$2"
+ find "$tree/usr/share/man" -type f |
+ while read src
+ do
+ base=$(basename "$src" .gz)
+ zcat "$src" > foo
+ env LC_ALL=C COLUMNS=80 man -l foo > "$wikidir/$name/$base.txt"
+ done
+}
+
+baseurl="http://192.168.122.113/jenkins"
+tempdir=$(mktemp -d)
+
+for deb in "$@"
+do
+ rm -rf "$tempdir/x"
+ mkdir "$tempdir/x"
+ name=$(dpkg -I "$deb" | sed -n '/^ Package: /s///p')
+ dpkg --fsys-tarfile "$deb" | tar -C "$tempdir/x" -xf -
+ publish_markdown "$tempdir/x" "$name" $markdown
+ publish_manpages "$tempdir/x" "$name"
+done
+
+rm -rf "$tempdir"
+