]> Cypherpunks.ru repositories - gocheese.git/blob - makedist.sh
Trivial shell optimizations
[gocheese.git] / makedist.sh
1 #!/bin/sh -ex
2
3 cur=$(pwd)
4 tmp=$(mktemp -d)
5 release=$1
6 [ -n "$release" ]
7
8 git clone . $tmp/gocheese-$release
9 cd $tmp/gocheese-$release
10 git checkout v$release
11
12 redo-ifchange VERSION
13
14 go mod vendor
15
16 cat > download.texi <<EOF
17 You can obtain releases source code prepared tarballs on
18 @url{http://www.gocheese.cypherpunks.ru/}.
19 EOF
20 redo gocheese.info
21
22 mkinfo() {
23     ${MAKEINFO:=makeinfo} --plaintext \
24         --set-customization-variable CLOSE_QUOTE_SYMBOL=\" \
25         --set-customization-variable OPEN_QUOTE_SYMBOL=\" \
26         -D "VERSION `cat VERSION`" $@
27 }
28
29 texi=$(mktemp)
30 cat > $texi <<EOF
31 \input texinfo
32 @documentencoding UTF-8
33 @settitle INSTALL
34 @include install.texi
35 @bye
36 EOF
37 perl -i -p -e "s/.verbatiminclude PUBKEY.asc/Look in PUBKEY.asc file./" install.texi
38 mkinfo --output INSTALL $texi
39 rm $texi
40
41 rm -rf .redo .git .gitignore style.css makedist.sh www.do VERSION.do
42 perl -i -npe "s/go} build/go} build -mod=vendor/" gocheese.do
43 perl -i -npe "s/go} test/go} test -mod=vendor/" test.do
44 cp ~/work/redo/minimal/do contrib/do
45
46 find . -type d -exec chmod 755 {} +
47 find . -type f -exec chmod 644 {} +
48 chmod +x contrib/pyshop2packages.sh contrib/do
49
50 cd ..
51 tar cvf gocheese-"$release".tar --uid=0 --gid=0 --numeric-owner gocheese-"$release"
52 zstd -19 -v gocheese-"$release".tar
53 gpg --detach-sign --sign --local-user CD5CD01F55343D88 gocheese-"$release".tar.zst
54
55 tarball=gocheese-"$release".tar.zst
56 size=$(( $(stat -f %z $tarball) / 1024 ))
57 hash=$(gpg --print-md SHA256 < $tarball)
58 release_date=$(date "+%Y-%m-%d")
59
60 cat <<EOF
61 An entry for documentation:
62 @item $release @tab $release_date @tab $size KiB
63 @tab @url{gocheese-${release}.tar.zst, link} @url{gocheese-${release}.tar.zst.sig, sign}
64 @tab @code{$hash}
65 EOF
66
67 mv $tmp/$tarball $tmp/"$tarball".sig $cur/gocheese.html/