#!/bin/sh -e
# git://git.stargrave.org/swg.git is used

html=spec.html
SWG_DO_BACKS=0 SWG_DO_SRC=0 swg htmls $html
perl -i -npe 's#^<title>.*$#<title>KEKS</title>#' $html/index.html
for pub in PUBKEY-CM.pub PUBKEY-CM.pub.asc PUBKEY-SSH.pub PUBKEY-SSH.pub.asc ; do
    [ -e $html/$pub ] || ln ../$pub $html
done

if [ -d $html/download ] ; then
    (
        cd $html/download
        export ATOM_ID="d18c0516-d0a8-44ee-b5b6-656591c9e520"
        export NAME=keks
        export BASE_URL=http://www.keks.cypherpunks.su/download
        export AUTHOR_EMAIL=keks@cypherpunks.su
        releases.atom.zsh || :
    )
    perl -i -npe 'print "<link rel=\"alternate\" title=\"Releases\" href=\"download/releases.atom\" type=\"application/atom+xml\">\n" if /^<\/head>/' $html/INSTALL.html
fi

find $html -type d -exec chmod 755 {} +
find $html -type f -exec chmod 644 {} +
