#!/bin/bash SRCTEST=src/server.c PACKAGE=lighttpd BASEDOWNLOADURL="http://download.lighttpd.net/lighttpd/releases-1.4.x" SNAPSHOTURL="http://download.lighttpd.net/lighttpd/snapshots-1.4.x" AUTHOR=stbuehler # may take one argument for prereleases like # ./packdist.sh [--nopack] rc1-r10 syntax() { echo "./packdist.sh [--nopack] [--help] [rc1-r10]" >&2 exit 2 } if [ ! -f ${SRCTEST} ]; then echo "Current directory is not the source directory" exit 1 fi dopack=1 while [ $# -gt 0 ]; do case "$1" in "--nopack") dopack=0 ;; "--help") syntax ;; "rc"*) if [ -n "$append" ]; then echo "Only one append allowed" >&2 syntax fi echo "Appending '$1'" append="$1" BASEDOWNLOADURL="${SNAPSHOTURL}" ;; *) echo "Unknown option '$1'" >&2 syntax ;; esac shift done force() { "$@" || { echo "Command failed: $*" exit 1 } } # summarize all changes since last release genchanges() { ( cat ../NEWS | sed "/^- ${version}/,/^-/p;d" | sed "/^- /d;/^$/d" | sed -e 's/^ \*/\*/' ) > CHANGES return 0 } # genereate links in old textile format "text":url genlinks_changes() { local repourl ticketurl inf out repourl="http://redmine.lighttpd.net/projects/lighttpd/repository/revisions/" ticketurl="http://redmine.lighttpd.net/issues/" inf="$1" outf="$1".links ( sed -e 's%\(http://[a-zA-Z0-9.:_/\-]\+\)%"\1":\1%g' | sed -e 's%#\([0-9]\+\)%"#\1":'"${ticketurl}"'\1%g' | sed -e 's%r\([0-9]\+\)%"r\1":'"${repourl}"'\1%g' | sed -e 's%\(CVE-[0-9\-]\+\)%"\1":http://cve.mitre.org/cgi-bin/cvename.cgi?name=\1%g' | cat ) < "$inf" > "$outf" } genlinks_downloads() { local repourl ticketurl inf out repourl="http://redmine.lighttpd.net/projects/lighttpd/repository/revisions/" ticketurl="http://redmine.lighttpd.net/issues/" inf="$1" outf="$1".links ( sed -e 's%\(http://[a-zA-Z0-9.:_/\-]\+\)%"\1":\1%g' | cat ) < "$inf" > "$outf" } blog_post() { if [ -z "${append}" ]; then # release cat < {% endexcerpt %} h4. Changes from ${prevversion} EOF cat CHANGES.links cat < "${name}.sha256sum" rm -f "${name}".tar.*.asc force gpg -a --output "${name}.tar.gz.asc" --detach-sig "${name}.tar.gz" force gpg -a --output "${name}.tar.bz2.asc" --detach-sig "${name}.tar.bz2" force gpg -a --output "${name}.tar.xz.asc" --detach-sig "${name}.tar.xz" ( echo "* ${BASEDOWNLOADURL}/${name}.tar.gz" echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.gz.asc" echo "** SHA256: @$(sha256sum ${name}.tar.gz | cut -d' ' -f1)@" echo "* ${BASEDOWNLOADURL}/${name}.tar.bz2" echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.bz2.asc" echo "** SHA256: @$(sha256sum ${name}.tar.bz2 | cut -d' ' -f1)@" echo "* ${BASEDOWNLOADURL}/${name}.tar.xz" echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.xz.asc" echo "** SHA256: @$(sha256sum ${name}.tar.xz | cut -d' ' -f1)@" echo "* SHA256 checksums: ${BASEDOWNLOADURL}/${name}.sha256sum" ) > DOWNLOADS ( echo "* \"${name}.tar.gz\":${BASEDOWNLOADURL}/${name}.tar.gz (\"GPG signature\":${BASEDOWNLOADURL}/${name}.tar.gz.asc)" echo "** SHA256: @$(sha256sum ${name}.tar.gz | cut -d' ' -f1)@" echo "* \"${name}.tar.bz\":${BASEDOWNLOADURL}/${name}.tar.bz2 (\"GPG signature\":${BASEDOWNLOADURL}/${name}.tar.bz2.asc)" echo "** SHA256: @$(sha256sum ${name}.tar.bz2 | cut -d' ' -f1)@" echo "* \"${name}.tar.xz\":${BASEDOWNLOADURL}/${name}.tar.xz (\"GPG signature\":${BASEDOWNLOADURL}/${name}.tar.xz.asc)" echo "** SHA256: @$(sha256sum ${name}.tar.xz | cut -d' ' -f1)@" echo "* \"SHA256 checksums\":${BASEDOWNLOADURL}/${name}.sha256sum" ) > DOWNLOADS.links force genchanges force genlinks_changes CHANGES #force genlinks_downloads DOWNLOADS prevversion="${version%.*}.$((${version##*.} - 1))" if [ -z "${append}" ]; then # only for Releases ( cat < "Release-${version//./_}.page" cat "Release-${version//./_}.page" fi echo echo ------- echo blog_post > $(date +"%Y-%m-%d")-"${version//./-}.textile" cat $(date +"%Y-%m-%d")-"${version//./-}.textile" echo echo ------- echo echo wget "${BASEDOWNLOADURL}/${name}".'{tar.gz,tar.bz2,tar.xz,sha256sum}; sha256sum -c '${name}'.sha256sum'