1#!/bin/bash 2 3SRCTEST=src/server.c 4PACKAGE=lighttpd 5BASEDOWNLOADURL="https://download.lighttpd.net/lighttpd/releases-1.4.x" 6SNAPSHOTURL="https://download.lighttpd.net/lighttpd/snapshots-1.4.x" 7 8if [[ "`id -un`" != "stbuehler" ]] && [[ -z "$AUTHOR" ]]; then 9 export AUTHOR="gstrauss" 10 export KEYID="AF16D0F0" 11fi 12 13AUTHOR="${AUTHOR:-stbuehler}" 14 15# may take one argument for prereleases like 16# ./packdist.sh [--nopack] rc1-r10 17 18syntax() { 19 echo "./packdist.sh [--nopack] [--help] [~rc1]" >&2 20 exit 2 21} 22 23if [ ! -f ${SRCTEST} ]; then 24 echo "Current directory is not the source directory" 25 exit 1 26fi 27 28dopack=1 29 30while [ $# -gt 0 ]; do 31 case "$1" in 32 "--nopack") 33 dopack=0 34 ;; 35 "--help") 36 syntax 37 ;; 38 "rc"*|"~rc"*) 39 if [ -n "$append" ]; then 40 echo "Only one append allowed" >&2 41 syntax 42 fi 43 echo "Appending '$1'" 44 append="$1" 45 BASEDOWNLOADURL="${SNAPSHOTURL}" 46 ;; 47 *) 48 echo "Unknown option '$1'" >&2 49 syntax 50 ;; 51 esac 52 shift 53done 54 55force() { 56 "$@" || { 57 echo "Command failed: $*" 58 exit 1 59 } 60} 61 62# summarize all changes since last release 63genchanges() { 64 ( 65 cat ../NEWS | sed "/^- ${version}/,/^-/p;d" | sed "/^- /d;/^$/d" | sed -e 's/^ \*/\*/' 66 ) > CHANGES 67 return 0 68} 69 70# generate links in old textile format "text":url 71genlinks_changes() { 72 local repourl ticketurl inf out 73 repourl="https://redmine.lighttpd.net/projects/lighttpd/repository/revisions/" 74 ticketurl="https://redmine.lighttpd.net/issues/" 75 inf="$1" 76 outf="$1".links 77 ( 78 sed -e 's%\(https://[a-zA-Z0-9.:_/\-]\+\)%"\1":\1%g' | 79 sed -e 's%#\([0-9]\+\)%"#\1":'"${ticketurl}"'\1%g' | 80 sed -e 's%r\([0-9]\+\)%"r\1":'"${repourl}"'\1%g' | 81 sed -e 's%\(CVE-[0-9\-]\+\)%"\1":https://cve.mitre.org/cgi-bin/cvename.cgi?name=\1%g' | 82 cat 83 ) < "$inf" > "$outf" 84} 85genlinks_downloads() { 86 local repourl ticketurl inf out 87 repourl="https://redmine.lighttpd.net/projects/lighttpd/repository/revisions/" 88 ticketurl="https://redmine.lighttpd.net/issues/" 89 inf="$1" 90 outf="$1".links 91 ( 92 sed -e 's%\(https://[a-zA-Z0-9.:_/\-]\+\)%"\1":\1%g' | 93 cat 94 ) < "$inf" > "$outf" 95} 96 97blog_post() { 98 if [ -z "${append}" ]; then 99 # release 100 cat <<EOF 101--- 102layout: post 103title: ${version} 104author: $AUTHOR 105author_email: ${AUTHOR}@lighttpd.net 106categories: 107- download 108tags: 109- ${version} 110- lighttpd 111- releases 112--- 113{% excerpt %} 114 115TODO 116 117h2. Important changes 118 119TODO 120 121h2. Downloads 122 123EOF 124 cat DOWNLOADS.links 125 cat <<EOF 126 127{% endexcerpt %} 128h2. Changes from ${prevversion} 129 130EOF 131 cat CHANGES.links 132 else 133 # pre release 134 cat <<EOF 135--- 136layout: post 137title: 'PRE-RELEASE: lighttpd ${version}${append}' 138categories: 139- lighttpd 140tags: 141- '1.4' 142- ${version} 143- lighttpd 144- prerelease 145--- 146{% excerpt %} 147We would like to draw your attention to the latest pre-release of the stable 1.4 branch of lighttpd. 148 149You can get the pre-release from these urls: 150EOF 151 cat DOWNLOADS.links 152 cat <<EOF 153 154Please test it as much as possible and provide us with feedback. 155A lot of testing ensures a good release. 156 157<!-- TODO: describe major changes --> 158 159{% endexcerpt %} 160 161h4. Changes from ${prevversion} 162 163EOF 164 cat CHANGES.links 165 166 cat <<EOF 167 168If you want to get the latest source for any branch, you can get it from our svn repository. 169Documentation to do so can be obtained from this page: "DevelSubversion":https://redmine.lighttpd.net/projects/lighttpd/wiki/DevelSubversion 170Bug reports or feature requests can be filed in our ticket system: "New Issue":https://redmine.lighttpd.net/projects/lighttpd/issues/new 171Please make sure to check if there isn't a ticket already here: "Issues":https://redmine.lighttpd.net/projects/lighttpd/issues 172Perhaps you also want to have a look at our "download site":https://download.lighttpd.net/lighttpd/ 173 174Thank you for flying light. 175EOF 176 fi 177} 178 179if [ ${dopack} = "1" ]; then 180 force ./autogen.sh 181 182 if [ -d distbuild ]; then 183 # make distcheck may leave readonly files 184 chmod u+w -R distbuild 185 rm -rf distbuild 186 fi 187 188 force mkdir distbuild 189 force cd distbuild 190 191 force ../configure --prefix=/usr 192 193 # force make 194 # force make check 195 196 force make -j 4 distcheck 197 force fakeroot make dist 198else 199 force cd distbuild 200fi 201 202version=`./config.status -V | head -n 1 | cut -d' ' -f3` 203name="${PACKAGE}-${version}" 204if [ -n "${append}" ]; then 205 cp "${name}.tar.gz" "${name}${append}.tar.gz" 206 cp "${name}.tar.xz" "${name}${append}.tar.xz" 207 name="${name}${append}" 208fi 209 210force sha256sum "${name}.tar."{gz,xz} > "${name}.sha256sum" 211 212rm -f "${name}".tar.*.asc 213 214force gpg ${KEYID:+-u "${KEYID}"} -a --output "${name}.tar.gz.asc" --detach-sig "${name}.tar.gz" 215force gpg ${KEYID:+-u "${KEYID}"} -a --output "${name}.tar.xz.asc" --detach-sig "${name}.tar.xz" 216 217( 218 echo "* ${BASEDOWNLOADURL}/${name}.tar.gz" 219 echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.gz.asc" 220 echo "** SHA256: @$(sha256sum ${name}.tar.gz | cut -d' ' -f1)@" 221 echo "* ${BASEDOWNLOADURL}/${name}.tar.xz" 222 echo "** GPG signature: ${BASEDOWNLOADURL}/${name}.tar.xz.asc" 223 echo "** SHA256: @$(sha256sum ${name}.tar.xz | cut -d' ' -f1)@" 224 echo "* SHA256 checksums: ${BASEDOWNLOADURL}/${name}.sha256sum" 225) > DOWNLOADS 226 227( 228 echo "* \"${name}.tar.gz\":${BASEDOWNLOADURL}/${name}.tar.gz (\"GPG signature\":${BASEDOWNLOADURL}/${name}.tar.gz.asc)" 229 echo "** SHA256: @$(sha256sum ${name}.tar.gz | cut -d' ' -f1)@" 230 echo "* \"${name}.tar.xz\":${BASEDOWNLOADURL}/${name}.tar.xz (\"GPG signature\":${BASEDOWNLOADURL}/${name}.tar.xz.asc)" 231 echo "** SHA256: @$(sha256sum ${name}.tar.xz | cut -d' ' -f1)@" 232 echo "* \"SHA256 checksums\":${BASEDOWNLOADURL}/${name}.sha256sum" 233) > DOWNLOADS.links 234 235force genchanges 236force genlinks_changes CHANGES 237#force genlinks_downloads DOWNLOADS 238 239prevversion="${version%.*}.$((${version##*.} - 1))" 240 241if [ -z "${append}" ]; then 242 # only for Releases 243 ( 244 cat <<EOF 245h1. Release Info 246 247* Version: ${version} 248* Previous version: [[Release-${prevversion//./_}|${prevversion}]] 249* Branch: 1.4 250* Status: stable 251* Release Purpose: bug fixes 252* Release manager: $AUTHOR 253* Released date: $(date +"%Y-%m-%d") 254 255h1. Important changes from ${prevversion} 256 257TODO 258 259h1. Downloads 260 261EOF 262 cat DOWNLOADS 263 cat <<EOF 264 265h1. Changes from ${prevversion} 266 267EOF 268 cat CHANGES 269 cat <<EOF 270 271h1. External references 272 273* https://www.lighttpd.net/$(date +"%Y/%-m/%-d")/${version} 274 275EOF 276 ) > "Release-${version//./_}.page" 277 278 cat "Release-${version//./_}.page" 279fi 280 281echo 282echo ------- 283echo 284 285 286 287blog_post > $(date +"%Y-%m-%d")-"${version}.textile" 288cat $(date +"%Y-%m-%d")-"${version}.textile" 289 290echo 291echo ------- 292echo 293 294echo wget "${BASEDOWNLOADURL}/${name}".'{tar.gz,tar.xz,sha256sum}; sha256sum -c '${name}'.sha256sum' 295