aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Łyszczek <michal.lyszczek@bofc.pl>2019-04-14 19:35:24 +0200
committerMichał Łyszczek <michal.lyszczek@bofc.pl>2019-04-14 19:35:24 +0200
commit82781da7f9a7477a95d2dc747c3503ede3c29ab5 (patch)
tree0a4c6f6b45bedb3c00f22cddaf7cdaf311cfb977
parent5b50d2353c65e51c0c5b44b08de5725fd23a798f (diff)
downloadntpd-setwait-82781da7f9a7477a95d2dc747c3503ede3c29ab5.tar.gz
ntpd-setwait-82781da7f9a7477a95d2dc747c3503ede3c29ab5.tar.bz2
ntpd-setwait-82781da7f9a7477a95d2dc747c3503ede3c29ab5.zip
add files to generate www site
Signed-off-by: Michał Łyszczek <michal.lyszczek@bofc.pl>
-rw-r--r--Makefile.am9
-rw-r--r--configure.ac3
-rwxr-xr-xgen-download-page.sh88
-rwxr-xr-xman2html.sh88
-rw-r--r--www/.gitignore5
-rw-r--r--www/Makefile.am11
-rw-r--r--www/custom.css64
-rw-r--r--www/footer.in26
-rw-r--r--www/header.in25
-rw-r--r--www/index.in7
l---------www/index.md1
-rwxr-xr-xwww/post-process.sh4
12 files changed, 327 insertions, 4 deletions
diff --git a/Makefile.am b/Makefile.am
index 3984764..7129936 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-ACLOCAL_AMFLAGS=-I m4
+SUBDIRS = www
EXTRA_DIST = readme.md init.d/ntpd-setwait.conf init.d/ntpd-setwait.openrc
@@ -26,4 +26,9 @@ analyze: $(analyze_plists)
endif # ENABLE_ANALYZER
-.PHONY: analyze
+www:
+ ./gen-download-page.sh
+ ./man2html.sh
+ make www -C www
+
+.PHONY: analyze www
diff --git a/configure.ac b/configure.ac
index 51afa9c..5886557 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2,10 +2,9 @@ AC_INIT([ntpd-setwait], [0.1.0], [michal.lyszczek@bofc.pl])
AM_INIT_AUTOMAKE([foreign subdir-objects])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([ntpd-setwait-config.h])
-AC_CONFIG_MACRO_DIR([m4])
AC_PROG_CC
AC_CANONICAL_HOST
-AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([Makefile www/Makefile])
###
diff --git a/gen-download-page.sh b/gen-download-page.sh
new file mode 100755
index 0000000..18d8ee2
--- /dev/null
+++ b/gen-download-page.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+project='ntpd-setwait'
+out='www/downloads.html'
+remote="https://distfiles.kurwinet.pl/${project}"
+gpg="https://distfiles.kurwinet.pl/bofc-signing.pub.gpg"
+asc="https://distfiles.kurwinet.pl/bofc-signing.pub.asc"
+
+get_files_from_remote()
+{
+ remote="${1}"
+
+ curl "${remote}/" -A "${project}-generator" 2>/dev/null | grep "a href=" | \
+ grep -v 'a href=".."' | cut -f2 -d\" | cut -f1 -d/
+}
+
+# extract links to files
+links="$(curl "${remote}/" -A "${project}-generator" 2>/dev/null \
+ | grep "${project}-[0-9]*\.[0-9]*\.[0-9]*\." | sort -r)"
+
+exec 6>&1
+exec 1<>"${out}"
+
+echo > "${out}"
+echo "<h1 class=\"first\">downloads</h1>"
+echo "<p>"
+echo "Below you can find source files to download."
+echo "<b>(s)</b> right of package name is a gpg signature. You can download"
+echo "<a href=\"${gpg}\">gpg file</a> or"
+echo "<a href=\"${asc}\">armored asc file</a> to verify files. You can also"
+echo "look for key on public keyservers, fingerprint is<br><br>"
+echo "&nbsp;&nbsp;&nbsp;&nbsp;63D0 C3DB 42AF 3B4F CF6E 7880 E84A 7E61 C785 0C62<br><br>"
+echo "You can download key directly from keyserver with<br><br>"
+echo "&nbsp;&nbsp;&nbsp;&nbsp;gpg --recv-keys 63D0C3DB42AF3B4FCF6E7880E84A7E61C7850C62<br><br>"
+echo "Then you can verify downloaded image with command<br><br>"
+echo "&nbsp;&nbsp;&nbsp;&nbsp;gpg --verify &lt;sig-file&gt; &lt;package-file&gt;"
+echo "</p><p>"
+echo "All files (including md5, sha256 and sha512 for all files) can also"
+echo "be downloaded from: <a href=\"${remote}/\">${remote}</a><br>"
+echo "</p>"
+echo "<h1>git</h1>"
+echo "<p>"
+echo "git clone git@kurwinet.pl:${project}<br>"
+echo "git clone git://kurwinet.pl/${project}<br>"
+echo "git clone http://git.kurwinet.pl/${project}<br>"
+echo "</p>"
+echo "<h1>tarballs (source code)</h1>"
+echo "<pre>"
+
+files="$(get_files_from_remote "${remote}/" | \
+ grep "${project}-[0-9]*\.[0-9]*\.[0-9][\.-]\(r[0-9]\)\?")"
+versions="$(echo "${files}" | tr ' ' '\n' | rev | \
+ cut -f1 -d- | rev | cut -f1-3 -d. | sort -Vur)"
+
+for v in ${versions}
+do
+ printf "%-10s%s(%s|%s) %s(%s|%s) %s(%s|%s)\n" "${v}" \
+ "<a href=\"${remote}/${project}-${v}.tar.gz\">tar.gz</a>" \
+ "<a href=\"${remote}/${project}-${v}.tar.gz.sig\">s</a>" \
+ "<a href=\"${remote}/${project}-${v}.tar.gz.sha1\">sha1</a>" \
+ "<a href=\"${remote}/${project}-${v}.tar.bz2\">tar.bz2</a>" \
+ "<a href=\"${remote}/${project}-${v}.tar.bz2.sig\">s</a>" \
+ "<a href=\"${remote}/${project}-${v}.tar.bz2.sha1\">sha1</a>" \
+ "<a href=\"${remote}/${project}-${v}.tar.xz\">tar.xz</a>" \
+ "<a href=\"${remote}/${project}-${v}.tar.xz.sig\">s</a>" \
+ "<a href=\"${remote}/${project}-${v}.tar.xz.sha1\">sha1</a>"
+done
+
+echo "</pre>"
+
+exec 1>&6 6>&-
+failed=0
+
+for l in $(lynx -listonly -nonumbers -dump "${out}" | grep "https://distfiles")
+do
+ echo -n "checking ${l}... "
+ curl -sSfl -A "${project}-generator" "${l}" >/dev/null
+
+ if [ ${?} -eq 0 ]
+ then
+ echo "ok"
+ continue
+ fi
+
+ failed=1
+done
+
+exit ${failed}
diff --git a/man2html.sh b/man2html.sh
new file mode 100755
index 0000000..18b66ad
--- /dev/null
+++ b/man2html.sh
@@ -0,0 +1,88 @@
+#!/bin/sh
+
+hostname="http://ntpd.kurwinet.pl"
+out="$(pwd)/www/manuals"
+root="$(pwd)"
+ftmp="/tmp/mtest-man2html"
+
+cd "${root}"
+mkdir "${out}"
+
+for m in *.[1-8]
+do
+ n="${m##*.}"
+ echo "opening ${m}"
+
+ if grep "\.so man${n}" "${m}"
+ then
+ sed -i "s/man${n}/man/" "${m}"
+ man2html -r -H "${hostname}" "${m}" > "${ftmp}"
+ sed -i "s/man\//man${n}\//g" "${m}"
+ else
+ man2html -r -H "${hostname}" "${m}" > "${ftmp}"
+ fi
+
+ # get only body part of the file
+ body_only="$(sed -n '/<BODY>/,/<\/BODY>/p' "${ftmp}")"
+ echo "$body_only" > "${ftmp}"
+
+ # remove leftover <body> and <h1>man</h1> tags from beginning
+ tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}"
+
+ # construct top page heading with page info, remove superflous info
+ name="$(basename ${m})"
+ name="${name%.*}"
+ version_info="$(head -n1 ${ftmp} | cut -f3 -d: | cut -f1 -d\<)"
+ tail -n+2 "${ftmp}" > tmp; mv tmp "${ftmp}"
+ sed -i "1s/^/<p class=\"info left\">${name}(${n})<\/p><p class=\"info center\">kurwinet manual pages<\/p><p class=\"info right\">${name}(${n})<\/p>\n<br><P> /" "${ftmp}"
+
+ # remove uneeded links to non-existing index
+ sed -i 's/<A HREF="\.\.\/index.html">Return to Main Contents<\/A><HR>//' "${ftmp}"
+ sed -i 's/<A HREF="#index">Index<\/A>//g' "${ftmp}"
+
+ # extract table of content and put it in the beginning of file
+ ## cache first two lines (page info) and remove them from file
+ tmp="$(head -n2 ${ftmp})"
+ tail -n+3 "${ftmp}" > tmp; mv tmp "${ftmp}"
+
+ ## get table of content from file
+ toc="$(sed '/<DL>/,$!d;H;/<\/DL>/!d;s/.*//;x;s/\n//' "${ftmp}")"
+
+ toc="$(echo "${toc}" | sed 's/<DL>/<UL class="man-toc">/')"
+ toc="$(echo "${toc}" | sed 's/<\/DL>/<\/UL>/')"
+ toc="$(echo "${toc}" | sed 's/<DT>/<LI>/')"
+ toc="$(echo "${toc}" | sed 's/<DD>/<\/LI>/')"
+
+ ## put table of content and first two lines into file and append hr
+ { echo -e "${tmp}\n${toc}\n<HR>"; cat "${ftmp}"; } > tmp; mv tmp "${ftmp}"
+
+ ## remove table of content and some uneeded info from bottom of file
+ sed -i '/^<A NAME="index">&nbsp;<\/A><H2>Index<\/H2>$/,$d' "${ftmp}"
+ head -n-3 "${ftmp}" > tmp; mv tmp "${ftmp}"
+
+ # change deprecated name in <a> into id
+ sed -i 's/A NAME="/A ID="/g' "${ftmp}"
+
+ # generate page info at bottom of page
+ echo "<p class=\"info left\"><a href=\"http://en.bofc.pl\">bofc.pl</a></p><p class=\"info center\">${version_info}</p><p class=\"info right\">${name}(${n})</p>" >> "${ftmp}"
+
+ # convert all h2 into h1 headings, man2html generates .SH as h2 and we want
+ # it as h1
+ sed -i 's/H2>/H1>/g' "${ftmp}"
+
+ # convert all h3 into h2 headings, man2html generates .SS as h3 and we want
+ # it as h2
+ sed -i 's/H3>/H2>/g' "${ftmp}"
+
+ # remove obsolete COMPACT from dl
+ sed -i 's/DL COMPACT/DL/g' "${ftmp}"
+
+ # change ../man# to ./ as we have all mans in single directory
+ sed -i 's/\.\.\/man.\//.\//g' "${ftmp}"
+
+ #remove <P> right before <PRE>
+ perl -i -0pe 's/<P>\n\n<PRE>/<PRE>/g' "${ftmp}"
+
+ # move generated file into output directory for further processing
+ cp "${ftmp}" "${out}/${m}.html"
+done
diff --git a/www/.gitignore b/www/.gitignore
new file mode 100644
index 0000000..a16a18d
--- /dev/null
+++ b/www/.gitignore
@@ -0,0 +1,5 @@
+/out
+/manuals
+/Makefile
+/Makefile.in
+/downloads.html
diff --git a/www/Makefile.am b/www/Makefile.am
new file mode 100644
index 0000000..ff1d09f
--- /dev/null
+++ b/www/Makefile.am
@@ -0,0 +1,11 @@
+EXTRA_DIST = custom.css footer.in header.in index.in index.md post-process.sh
+
+www:
+ kursg -o out
+ ./post-process.sh
+ chmod a+rX out -R
+
+make clean:
+ $(RM) -r out
+ $(RM) -r manuals
+ $(RM) downloads.html
diff --git a/www/custom.css b/www/custom.css
new file mode 100644
index 0000000..f60c90e
--- /dev/null
+++ b/www/custom.css
@@ -0,0 +1,64 @@
+pre#logo
+{
+ font-size: 3px;
+ max-width: 100%;
+}
+
+pre#logo-footer
+{
+ font-size: 1px;
+ max-width: 100%;
+}
+
+div#footer a:hover, div#header a:hover
+{
+ color: red;
+ text-decoration: none;
+}
+
+div.codehilite:before
+{
+ content: "// code";
+}
+
+img[alt=test-result-svg]
+{
+ float: right;
+}
+
+p.info
+{
+ margin-top: 2ch;
+ margin-bottom: 2ch;
+ margin-left: 0ch;
+ margin-right: 0ch;
+ float: left;
+}
+
+p.left
+{
+ text-align: left;
+ width: 33%
+}
+
+p.center
+{
+ text-align: center;
+ width: 33%
+}
+
+p.right
+{
+ text-align: right;
+ width: 34%
+}
+
+ul.man-toc
+{
+ clear: both;
+}
+
+h1.first
+{
+ margin-top: 2ch;
+}
diff --git a/www/footer.in b/www/footer.in
new file mode 100644
index 0000000..bf90771
--- /dev/null
+++ b/www/footer.in
@@ -0,0 +1,26 @@
+ <a href="http://en.bofc.pl"><pre id="logo-footer">
+  
+88888888  
+8::::::8 8888888888888888 8888888 
+8::::::8 8::::::::::::::::8 8:::::8 
+8::::::8 8::::::::::::::::::8 8:::::8 
+ 8:::::8 8::::::8888888:::::8 8:::::8 
+ 8:::::888888888 88888888888 8:::::8 8888888888888888888888 88888 888888888 8::::8 
+ 8::::::::::::::88 88:::::::::::88 8:::::8 88:::::::::::::::8 8::::888:::::::::8 8::::8 
+ 8::::::::::::::::8 8:::::::::::::::88:::::::888888 8:::::::::::::::::8 8:::::::::::::::::8 8::::8 
+ 8:::::88888:::::::88:::::88888:::::88::::::::::::8 8:::::::888888:::::8 88::::::88888::::::8 8::::8 
+ 8:::::8 8::::::88::::8 8::::88::::::::::::8 8::::::8 8888888 8:::::8 8:::::8 8::::8  
+ 8:::::8 8:::::88::::8 8::::88:::::::888888 8:::::8 8:::::8 8:::::8 8::::8  
+ 8:::::8 8:::::88::::8 8::::8 8:::::8 8:::::8 8:::::8 8:::::8 8::::8  
+ 8:::::8 8:::::88::::8 8::::8 8:::::8 8::::::8 8888888 8:::::8 8::::::8 8::::8  
+ 8:::::888888::::::88:::::88888:::::88:::::::8 8:::::::888888:::::8 8:::::88888:::::::88::::::8
+ 8::::::::::::::::8 8:::::::::::::::88:::::::8 8:::::::::::::::::8 ...... 8::::::::::::::::8 8::::::8
+ 8:::::::::::::::8 88:::::::::::88 8:::::::8 88:::::::::::::::8 .::::. 8::::::::::::::88 8::::::8
+ 8888888888888888 88888888888 888888888 8888888888888888 ...... 8::::::88888888 88888888
+ 8:::::8  
+ 8:::::8  
+ 8:::::::8  
+ 8:::::::8  
+ 8:::::::8  
+ 888888888  
+ </pre></a>
diff --git a/www/header.in b/www/header.in
new file mode 100644
index 0000000..ac83b4f
--- /dev/null
+++ b/www/header.in
@@ -0,0 +1,25 @@
+<a href="/"><pre id="logo">
+ 88888888
+ 8888 8::::::8 8888 8888 8888
+ 888:::8 8::::::8 888:::8 8::::8 888:::8
+ 8:::::8 8::::::8 8:::::8 8888 8:::::8
+ 8:::::8 8:::::8 8:::::8 8:::::8
+8888 88888888 8888888:::::8888888 88888 888888888 888888888:::::8 8888888888 888888888888 8888888:::::88888888888888 88888 88888888888888888888 88888888888888:::::8888888
+8:::88::::::::88 8:::::::::::::::::8 8::::888:::::::::8 88::::::::::::::8 88::::::::::8 88::::::::::::88 8:::::::::::::::::8 8:::::8 8:::::8 8:::::8 8::::::::::::8 8:::::88:::::::::::::::::8
+8::::::::::::::88 8:::::::::::::::::8 8:::::::::::::::::8 8::::::::::::::::8 88:::::::::::::8 8::::::88888:::::888:::::::::::::::::8 8:::::8 8:::::::8 8:::::8 888888888:::::8 8::::88:::::::::::::::::8
+88:::::::::::::::8888888:::::::888888 88::::::88888::::::88:::::::88888:::::8 --------------- 8::::::8888:::::88::::::8 8:::::8888888:::::::888888 8:::::8 8:::::::::8 8:::::8 8::::8 8::::8888888:::::::888888
+ 8:::::8888:::::8 8:::::8 8:::::8 8:::::88::::::8 8:::::8 -:::::::::::::- 8:::::8 888888 8:::::::88888::::::8 8:::::8 8:::::8 8:::::8:::::8 8:::::8 8888888:::::8 8::::8 8:::::8
+ 8::::8 8::::8 8:::::8 8:::::8 8:::::88:::::8 8:::::8 --------------- 8::::::8 8:::::::::::::::::8 8:::::8 8:::::8 8:::::8 8:::::8 8:::::8 88::::::::::::8 8::::8 8:::::8
+ 8::::8 8::::8 8:::::8 8:::::8 8:::::88:::::8 8:::::8 8::::::8 8::::::88888888888 8:::::8 8:::::8:::::8 8:::::8:::::8 8::::8888::::::8 8::::8 8:::::8
+ 8::::8 8::::8 8:::::8 8888888:::::8 8::::::88:::::8 8:::::8 888888 8:::::8 8:::::::8 8:::::8 888888 8:::::::::8 8:::::::::8 8::::8 8:::::8 8::::8 8:::::8 888888
+ 8::::8 8::::8 8::::::8888:::::88:::::88888:::::::88::::::88888::::::88 8:::::8888::::::88::::::::8 8::::::8888:::::8 8:::::::8 8:::::::8 8::::8 8:::::8 8::::::8 8::::::8888:::::8
+ 8::::8 8::::8 88::::::::::::::88::::::::::::::::8 8:::::::::::::::::8 8::::::::::::::8 8::::::::88888888 88::::::::::::::8 8:::::8 8:::::8 8:::::8888::::::8 8::::::8 88::::::::::::::8
+ 8::::8 8::::8 88:::::::::::888::::::::::::::88 8:::::::::888::::8 8:::::::::::88 88:::::::::::::8 88:::::::::::88 8:::8 8:::8 8::::::::::88:::88::::::8 88:::::::::::88
+ 888888 888888 88888888888 8::::::88888888 888888888 88888 88888888888 88888888888888 88888888888 888 888 8888888888 888888888888 88888888888
+ 8:::::8
+ 8:::::8
+ 8:::::::8
+ 8:::::::8
+ 8:::::::8
+ 888888888
+</pre></a>
diff --git a/www/index.in b/www/index.in
new file mode 100644
index 0000000..f341714
--- /dev/null
+++ b/www/index.in
@@ -0,0 +1,7 @@
+in_title="ntpd-setwait.kurwinet.pl - program to set system time from ntp before running ntpd daemon"
+in_description="program to set system time from ntp before running ntpd daemon"
+in_keywords="c, ntp, ntpd, ntpd-wait, ntpd-setwait"
+in_author="Michał Łyszczek"
+in_lang="en"
+in_pygment=vim
+in_style=man
diff --git a/www/index.md b/www/index.md
new file mode 120000
index 0000000..15926e3
--- /dev/null
+++ b/www/index.md
@@ -0,0 +1 @@
+../readme.md \ No newline at end of file
diff --git a/www/post-process.sh b/www/post-process.sh
new file mode 100755
index 0000000..ff643d6
--- /dev/null
+++ b/www/post-process.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+# add single new line before about in index.html
+sed -i 's/<h1 id="about">/<h1 id="about" class="first">/' "out/index.html"