summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-04-21 21:18:53 +1200
committerLars Wirzenius <liw@liw.fi>2010-04-21 21:18:53 +1200
commit3798ad8f827a3dadeb803b0c4bc06179ae90fd95 (patch)
tree3d060b010b08ec09dd61e9fb134c7bf72427f7e0
parent69debc6e7eea3060a1f46195274f4c14fa550364 (diff)
downloadliw-automation-3798ad8f827a3dadeb803b0c4bc06179ae90fd95.tar.gz
Add build-journal and journal-note.
-rw-r--r--build-journal6
-rw-r--r--debian/changelog6
-rw-r--r--debian/liw-automation.install2
-rw-r--r--journal-note46
4 files changed, 60 insertions, 0 deletions
diff --git a/build-journal b/build-journal
new file mode 100644
index 0000000..cf12f3f
--- /dev/null
+++ b/build-journal
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+set -e
+
+ikiwiki --setup $HOME/Journal/ikiwiki.setup
+
diff --git a/debian/changelog b/debian/changelog
index 5dd13f5..8675c6d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+liw-automation (3) squeeze; urgency=low
+
+ * Add build-journal and journal-note.
+
+ -- Lars Wirzenius <liw@liw.fi> Wed, 21 Apr 2010 21:18:29 +1200
+
liw-automation (2) squeeze; urgency=low
* Add g.
diff --git a/debian/liw-automation.install b/debian/liw-automation.install
index 6bfcf47..8d4ed04 100644
--- a/debian/liw-automation.install
+++ b/debian/liw-automation.install
@@ -1,2 +1,4 @@
sync-to-pieni usr/bin
g usr/bin
+build-journal usr/bin
+journal-note usr/bin
diff --git a/journal-note b/journal-note
new file mode 100644
index 0000000..eeed7a3
--- /dev/null
+++ b/journal-note
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+set -e
+
+if [ "$#" != 1 ]
+then
+ echo "Usage: $0 title"
+ exit 1
+fi
+
+title="$1"
+temp="$(mktemp)"
+
+cat << eof > "$temp"
+[[!meta title="$title"]]
+[[!tag ]]
+[[!meta date="$(date +%Y-%m-%dT%H:%M)"]]
+
+eof
+
+checksum="$(mktemp)"
+md5sum "$temp" > "$checksum"
+vi "$temp"
+if md5sum --status -c "$checksum"
+then
+ echo "No change to note, aborting."
+ rm "$temp" "$checksum"
+ exit 1
+fi
+
+cat << eof >> "$temp"
+
+[[!meta done="$(date +%Y-%m-%dT%H:%M)"]]
+eof
+
+cd "$HOME/Journal/src"
+filename="notes/$(date +%Y-%m-%d-%H:%M.mdwn)"
+if [ -e "$filename" ]
+then
+ filename="notes/$(date +%Y-%m-%d-%H:%M:%S.mdwn)"
+fi
+cp "$temp" "$filename"
+bzr add "$filename"
+bzr commit -m "New note" "$filename"
+ikiwiki --setup ../ikiwiki.setup --refresh
+rm "$temp" "$checksum"