Files: 3077b00cc9073a00c865eee83fdc91b2f77acacb / feed.sh
1156 bytesRaw
1 | |
2 | |
3 | test -z "$SITE_URL" && echo 'Define the SITE_URL env variable' >&2 && exit 1 |
4 | |
5 | hash uuidgen >&2 || uuidgen() { |
6 | cat /proc/sys/kernel/random/uuid 2>&- ||\ # Linux |
7 | cat /compat/linux/proc/sys/kernel/random/uuid 2>&- ||\ # FreeBSD |
8 | python -c 'import uuid; print uuid.uuid1()' |
9 | } |
10 | |
11 | : ${SITE_TITLE:=My Cool Site} |
12 | : ${SITE_AUTHOR:=$(grep $(id -u) /etc/passwd | cut -d: -f 5 | cut -d, -f1)} |
13 | : ${SITE_ID:=$(cat site_id 2>&- || echo urn:uuid:$(uuidgen) | tee site_id)} |
14 | : ${FEED_ENTRIES:=15} |
15 | : ${FEED_WIDTH:=80} |
16 | |
17 | cat <<EOF |
18 | <?xml version="1.0" encoding="utf-8"?> |
19 | <feed xmlns="http://www.w3.org/2005/Atom"> |
20 | <title>$SITE_TITLE</title> |
21 | <link rel="alternate" type="text/html" href="$SITE_URL"/> |
22 | <link rel="self" type="application/rss+xml" href="${SITE_URL}feed.xml"/> |
23 | <updated>$(date --iso-8601=seconds | sed 's/..$/:&/')</updated> |
24 | <id>$SITE_ID</id> |
25 | |
26 | EOF |
27 | |
28 | content_delim=$(uuidgen) |
29 | |
30 | git log -$FEED_ENTRIES --stat=$FEED_WIDTH --format=format:"entry $content_delim |
31 | title %s |
32 | id %H |
33 | name %aN |
34 | email %aE |
35 | updated %ai |
36 | content $content_delim |
37 | commit %H |
38 | |
39 | %B |
40 | stat $content_delim" $@ | awk -f xml.awk -v site="$SITE_URL" |
41 | |
42 | cat <<EOF |
43 | </feed> |
44 | |
45 | EOF |
46 |
Built with git-ssb-web