From 2196b2fbd431772e161104d7c17ca77be70ec524 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Fri, 19 Jul 2024 10:44:13 +0200 Subject: [PATCH] Throw file checksums on a separate page + ncdu link updates --- .gitignore | 2 ++ Makefile | 11 ++++-- dat/ncdu.md | 81 +++++++++++++++++++++--------------------- dllink.pl | 36 ------------------- mkdlpage.pl | 42 ++++++++++++++++++++++ pub/.htaccess | 2 +- pub/download/.htaccess | 2 -- pub/style.css | 21 ++++++----- template.html | 10 +----- 9 files changed, 104 insertions(+), 103 deletions(-) delete mode 100755 dllink.pl create mode 100755 mkdlpage.pl delete mode 100644 pub/download/.htaccess diff --git a/.gitignore b/.gitignore index 2d4b5a3..c6345f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.zip *.gz *.pdf +dat/download.md dat/globster/api.md dat/globster/api.pod dat/globster/ctl.md @@ -59,6 +60,7 @@ pub/doc/pwlookup.html pub/doc/sqlaccess.html pub/doc/sqlobject.html pub/doc/vndbtitles.html +pub/download.html pub/dump.html pub/dump/awshrink.html pub/dump/btrfssize.html diff --git a/Makefile b/Makefile index 5143116..0aff1d0 100644 --- a/Makefile +++ b/Makefile @@ -26,6 +26,7 @@ PAGES=\ "doc/sqlaccess.md"\ "doc/sqlobject.md"\ "doc/vndbtitles.md"\ + "download.dl"\ "dump.md"\ "dump/awshrink.md"\ "dump/btrfssize.md"\ @@ -104,7 +105,7 @@ CHANGES_MD := $(shell for i in ${PAGES}; do echo "$$i" | grep -Eo '^[^ ]+\.log' MDOC_MD := $(shell for i in ${PAGES}; do echo "$$i" | grep -Eo '^[^ ]+\.mdoc' | sed -E 's/(.+)\.mdoc$$/dat\/\1.md/'; done) # All fetched & generated files -CLEAN := ${FETCH} ${POD_MD} ${CHANGES_MD} ${MDOC_MD} ${HTML_OUT} ${FEEDS} +CLEAN := dat/download.md ${FETCH} ${POD_MD} ${CHANGES_MD} ${MDOC_MD} ${HTML_OUT} ${FEEDS} .PHONY: all clean @@ -121,7 +122,7 @@ ${FEEDS}: mkfeed.pl dat/index.md ${FETCH}: dat/%: @echo "FETCH $*" @mkdir -p $$(dirname "$@") - @curl -s ${shell for i in ${PAGES}; do case "$$i" in "$* "*) echo "$$i" | awk '{print$$2}';; esac; done} -o "$@" + @curl --user-agent 'YHDEV' -s ${shell for i in ${PAGES}; do case "$$i" in "$* "*) echo "$$i" | awk '{print$$2}';; esac; done} -o "$@" # There is a 'pod2markdown' program, but going through HTML with a little bit @@ -156,11 +157,15 @@ ${MDOC_MD}: dat/%.md: dat/%.mdoc ) >"$@" +dat/download.md: mkdlpage.pl pub/download/*.sha256 + ./mkdlpage.pl >"$@" + + ${HTML_OUT}: pub/%.html: dat/%.md template.html @echo "HTML $*" @mkdir -p $$(dirname "$@") @cat "$<" |\ - ./dllink.pl |\ + sed -E 's/\[([^]]+)\]\(\/download\/([^\) ]+)\)/\0 ⓘ<\/a>/g' |\ pandoc -f markdown -t html5 --strip-comments --template template.html \ --metadata path1=$$(echo "$*" | sed 's/\/.*//') \ --metadata path2=$$(echo "$*" | sed 's/\//-/' | sed 's/\/.*//') \ diff --git a/dat/ncdu.md b/dat/ncdu.md index fb38273..7829ad0 100644 --- a/dat/ncdu.md +++ b/dat/ncdu.md @@ -17,15 +17,13 @@ Static binaries [AArch64](/download/ncdu-2.4-linux-aarch64.tar.gz). Zig version (stable) -: 2.4 ([ncdu-2.4.tar.gz](/download/ncdu-2.4.tar.gz) - [changes](/ncdu/changes2) - requires Zig 0.12 or 0.13) +: 2.4 ([ncdu-2.4.tar.gz](/download/ncdu-2.4.tar.gz) - [changes](/ncdu/changes2)) - See the [beta release announcement](/doc/ncdu2) for information about the - motivation for the rewrite and some of the differences with the C version. + Requires Zig 0.12 or 0.13. - Note that the [Zig language](https://ziglang.org/) and compiler are still - very much unstable. This version of ncdu will *only* work with the version - of the Zig compiler noted above. Use the ncdu 1.x branch if this does not - work for you or if you need a more stable compilation environment. + The [Zig language](https://ziglang.org/) and compiler are still somewhat + unstable, use the ncdu 1.x branch if this does not work for you or if you + need a more stable compilation environment. C version (LTS) : 1.20 ([ncdu-1.20.tar.gz](/download/ncdu-1.20.tar.gz) - [changes](/ncdu/changes)) @@ -34,12 +32,15 @@ C version (LTS) but is still being maintained and perfectly usable. Development version -: The most recent code is available on a git repository and can be cloned - with `git clone git://g.blicky.net/ncdu.git/`. The repository is also - available for [online browsing](https://code.blicky.net/yorhel/ncdu/) (and - [through cgit](https://g.blicky.net/ncdu.git/) if you prefer that). The - 'master' branch represents the C version, the Zig version can be found in - the 'zig' branch. +: The most recent code is available on git: + ``` + git clone git://g.blicky.net/ncdu.git/ + ``` + The repository is also available for online browsing on + [Forgejo](https://code.blicky.net/yorhel/ncdu/) and + [cgit](https://g.blicky.net/ncdu.git/). + The 'master' branch represents the C version, the Zig version can be found + in the 'zig' branch. License : MIT. @@ -49,50 +50,48 @@ License Ncdu has been packaged for quite a few systems, here's a list of the ones I am aware of: [AIX](http://www.perzl.org/aix/index.php?n=Main.Ncdu) - -[Alpine Linux](http://pkgs.alpinelinux.org/packages?name=ncdu) - -[ALT Linux](http://sisyphus.ru/en/srpm/ncdu) - +[Alpine Linux](http://pkgs.alpinelinux.org/packages?name=ncdu) ([2](https://pkgs.alpinelinux.org/packages?name=ncdu2&branch=edge&repo=&arch=&maintainer=)) - +[ALT Linux](https://packages.altlinux.org/en/sisyphus/srpms/ncdu/) - [Arch Linux](https://www.archlinux.org/packages/?q=ncdu) - [CRUX](https://crux.nu/portdb/?q=ncdu&a=search) - [Cygwin](https://cygwin.com/cgi-bin2/package-grep.cgi?grep=ncdu) - [Debian](http://packages.debian.org/ncdu) - -[Fedora](https://apps.fedoraproject.org/packages/ncdu) - +[Fedora](https://packages.fedoraproject.org/pkgs/ncdu/ncdu/) - [FreeBSD](https://www.freebsd.org/cgi/ports.cgi?query=ncdu&stype=all) - -[Frugalware](http://frugalware.org/packages/?op=pkg&srch=ncdu&arch=all&ver=all) - -[Gentoo](https://packages.gentoo.org/packages/sys-fs/ncdu) - +[Frugalware](https://frugalware.org/package/ncdu/) - +[Gentoo](https://packages.gentoo.org/packages/sys-fs/ncdu) ([-bin](https://packages.gentoo.org/packages/sys-fs/ncdu-bin)) - [GNU Guix](https://guix.gnu.org/packages/N/) - [NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/ncdu/default.nix) - -[OpenBSD](http://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/sysutils/ncdu/) - +[OpenBSD](https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/sysutils/ncdu/) - +[openSUSE](https://software.opensuse.org//download.html?project=utilities&package=ncdu). [OpenWRT](https://openwrt.org/packages/pkgdata/ncdu) - -MacOS ([Fink](http://pdb.finkproject.org/pdb/package.php/ncdu) - [Homebrew](https://formulae.brew.sh/formula/ncdu) - [MacPorts](http://www.macports.org/ports.php?by=name&substr=ncdu)) - -[Puppy Linux](http://www.murga-linux.com/puppy/viewtopic.php?t=35024) - -[Solaris](http://www.opencsw.org/packages/ncdu) - -[Slackware](http://slackbuilds.org/repository/14.2/system/ncdu/) - -[Slax Linux](http://www.slax.org/modules.php?detail=ncdu) - -[Ubuntu](http://packages.ubuntu.com/search?searchon=sourcenames&keywords=ncdu) - -[Void Linux](https://voidlinux.org/packages/) - -Packages for RHEL and (open)SUSE can be found on the -[Open Build Service](https://software.opensuse.org//download.html?project=utilities&package=ncdu). +MacOS ([Fink](https://pdb.finkproject.org/pdb/package.php/ncdu) - [Homebrew](https://formulae.brew.sh/formula/ncdu) - [MacPorts](https://ports.macports.org/search/?q=ncdu&name=on)) - +[Solaris](https://www.opencsw.org/packages/ncdu) - +[Slackware](https://slackbuilds.org/repository/15.0/system/ncdu/) - +[Ubuntu](https://packages.ubuntu.com/search?searchon=sourcenames&keywords=ncdu) - +[Void Linux](https://voidlinux.org/packages/?arch=x86_64&q=ncdu). Packages for NetBSD, DragonFlyBSD, MirBSD and others can be found on [pkgsrc](http://pkgsrc.se/sysutils/ncdu). -A port to z/OS is available [here](https://dovetail.com/community/ncdu.html). - ## Similar projects -- [Duc](http://duc.zevv.nl/) - Multiple user interfaces. -- [gt5](http://gt5.sourceforge.net/) - Quite similar to ncdu, but a different approach. -- [gdu](https://github.com/dundee/gdu) - Go disk usage analyzer inspired by ncdu. -- [dua](https://github.com/Byron/dua-cli) - Rust disk usage analyzer with a CLI. -- [diskonaut](https://github.com/imsnif/diskonaut) - Rust disk usage analyzer with a TUI. -- [godu](https://github.com/viktomas/godu) - Another Go disk usage analyzer, with a slightly different browser UI. -- [tdu](https://bitbucket.org/josephpaul0/tdu) - Go command-line tool with ncdu JSON export. +There's no shortage of alternatives to ncdu nowadays. In no particular order: + +- [Duc](http://duc.zevv.nl/) - Multiple user interfaces, C, scales beyond directories that fit in RAM. +- [gt5](http://gt5.sourceforge.net/) - TUI/HTML, also supports diffing. +- [gdu](https://github.com/dundee/gdu) - TUI/CLI, Go, supports ncdu JSON export and import. +- [dua](https://github.com/Byron/dua-cli) - CLI, Rust. +- [pdu](https://github.com/KSXGitHub/parallel-disk-usage) - CLI, Rust. +- [diskonaut](https://github.com/imsnif/diskonaut) - TUI, Rust, treemap. +- [dut](https://codeberg.org/201984/dut), CLI, C. +- [godu](https://github.com/viktomas/godu) - TUI, Go, slightly different browser UI. +- [tdu](https://github.com/josephpaul0/tdu) - CLI, Go, supports ncdu JSON export. - [TreeSize](http://treesize.sourceforge.net/) - GTK, using a treeview. -- [Baobab](http://www.marzocca.net/linux/baobab.html) - GTK, using pie-charts, a treeview and a treemap. Comes with GNOME. -- [GdMap](http://gdmap.sourceforge.net/) - GTK, with a treemap display. +- [Baobab](http://www.marzocca.net/linux/baobab/) - GTK, using pie-charts, a treeview and a treemap. Comes with GNOME. +- [GdMap](http://gdmap.sourceforge.net/) - GTK, treemap. - [Filelight](https://apps.kde.org/filelight/) - KDE, using pie-charts. -- [QDirStat](https://github.com/shundhammer/qdirstat) - Qt, with a treemap display. +- [QDirStat](https://github.com/shundhammer/qdirstat) - Qt, treemap. - [K4DirStat](https://github.com/jeromerobert/k4dirstat) - Qt, treemap. - [xdiskusage](http://xdiskusage.sourceforge.net/) - FLTK, with a treemap display. - [fsv](http://fsv.sourceforge.net/) - 3D visualization. diff --git a/dllink.pl b/dllink.pl deleted file mode 100755 index 43774b7..0000000 --- a/dllink.pl +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/perl -p - -# This script adds an information icon to any link into /download/* - if there -# is more information to display than just the file name and size. - -use autodie; - -sub slurp { local $/=undef; open F, '<', shift; } -sub fullsize { scalar reverse join ".", unpack "(A3)*", reverse shift } -sub size { $s=shift; $s > 1<<20 ? sprintf '%.1f MiB', $s/(1<<20) : sprintf '%.1f KiB', $s/1024 } - -sub file { - ($code, $lbl, $fn) = @_; - my @info; - push @info, sprintf 'PGP: %1$s.asc', $fn if -e "$fn.asc"; - push @info, sprintf 'MD5: %s', (slurp "$fn.md5") =~ /^([^ ]+)/ if -e "$fn.md5"; - push @info, sprintf 'SHA1: %s', (slurp "$fn.sha1") =~ /^([^ ]+)/ if -e "$fn.sha1"; - push @info, sprintf 'SHA-256: %s', (slurp "$fn.sha256") =~ /^([^ ]+)/ if -e "$fn.sha256"; - return $code if !@info; - unshift @info, sprintf 'Size: %s (%s bytes)', size(-s $fn), fullsize(-s $fn); - unshift @info, sprintf 'File: %1$s', $fn; - - $id = sprintf 'fileinfo_%d', rand 1<<32; - qq{} - . qq{} - . qq{} - . qq{} - . join('
', @info) - . qq{
} - . $code - . qq{ } - .qq{
} -} - -BEGIN { chdir 'pub/download' } -s{\[([^\]]+)\]\(/download/([^\) ]+)\)}{file $&,$1,$2}eg; diff --git a/mkdlpage.pl b/mkdlpage.pl new file mode 100755 index 0000000..9b6ccaf --- /dev/null +++ b/mkdlpage.pl @@ -0,0 +1,42 @@ +#!/usr/bin/perl + +use v5.36; +use autodie; + +say '---'; +say 'title: Downloads'; +say 'page-type: dl'; +say '...'; +say ''; +say 'All PGP signatures are signed with my [personal key](https://yorhel.nl/key.asc) with fingerprint:
'; +say '`7446 0D32 B808 10EB A9AF A2E9 6239 4C69 8C27 39FA`.'; +say ''; +say 'Checksums are also [committed into git](https://g.blicky.net/yorhel-dev.git/tree/pub/download).'; +say ''; + +chdir 'pub/download'; + +sub slurp { local $/=undef; open my $F, '<', shift; <$F> } +sub hash { slurp(shift) =~ s/ .*$//sr } +sub fullsize { scalar reverse join ".", unpack "(A3)*", reverse shift } +sub size($s) { $s > 1<<20 ? sprintf '%.1f MiB', $s/(1<<20) : sprintf '%.1f KiB', $s/1024 } + +# Attempt to get a more natural order, +sub expandNum { shift =~ s{([0-9]+(?:\.[0-9]+)*)}{ my $s = $1 =~ s/\.?([0-9]+)/sprintf '%07d', $1/erg; $s . ('0'x(50-length $s)) }erg =~ s/-/~/rg; } + +for my $sha256 (sort { expandNum($a) cmp expandNum($b) } glob '*.sha256') { + my $fn = $sha256 =~ s/\.sha256$//r; + my $size = size -s $fn; + my $fullsize = fullsize -s $fn; + my $id = $fn =~ s/\./_/rg; + + say qq{$fn 🔗}; + say ": "; + say " "; + say ' '; + say ' '; + say ' '; + say " "; + say '
Size $fullsize bytes ($size)
MD5 '.hash("$fn.md5").'
SHA1 '.hash("$fn.sha1").'
SHA256'.hash("$fn.sha256").'
PGP asc
'; + say ''; +} diff --git a/pub/.htaccess b/pub/.htaccess index b7c417b..69b4933 100644 --- a/pub/.htaccess +++ b/pub/.htaccess @@ -240,7 +240,7 @@ RewriteRule ^yxml/bug/2$ https://code.blicky.net/yorhel/yxml/issues/2 [L RewriteRule ^yxml/bug.*$ https://code.blicky.net/yorhel/yxml/issues [L,R=permanent] # No trailing slash (except for the download/ directory index) -RewriteCond %{REQUEST_URI} !^/download +#RewriteCond %{REQUEST_URI} !^/download RewriteRule ^(.+)/$ $1 [L,R=permanent] RewriteCond %{REQUEST_FILENAME}.html -s diff --git a/pub/download/.htaccess b/pub/download/.htaccess deleted file mode 100644 index ef5cdf8..0000000 --- a/pub/download/.htaccess +++ /dev/null @@ -1,2 +0,0 @@ -Options +Indexes -DirectorySlash on diff --git a/pub/style.css b/pub/style.css index 5e2b1f2..3143762 100644 --- a/pub/style.css +++ b/pub/style.css @@ -23,10 +23,9 @@ header li a.small { font-size: 10px } header li a.external:after { content: url(/img/external.gif) } header li a.fwd:after { content: ' »' } header li a.back:before { content: '« ' } -header p { margin: 50px 0 0 0; text-align: center } +header p { margin: 50px 0 -10px 0; text-align: center } header p, header p * { font-size: 9px; text-decoration: none; line-height: 1.8em } header p a:hover { text-decoration: underline } -header p i { font-size: 7px; display: block; margin-top: -2px; margin-bottom: -10px; font-style: normal } header p b { display: block; margin-top: 10px; margin-bottom: 2px } @media (min-width: 1200px) { @@ -85,15 +84,15 @@ main .sig, main .sig a { font-size: 9px; color: #333; text-decoration: none } .page-changelog > ul > li { margin-bottom: 1.3em } .page-changelog li li { margin-left: 1em } -.fileinfo { position: relative } -.fileinfo input { display: none } -.fileinfo label { cursor: pointer } -.fileinfo label img { height: 12px } -.fileinfo span label { position: absolute; right: 0; top: 0; padding: 5px } -.fileinfo span { position: absolute; top: 25px; left: -80px; background: #eee; border: 1px dashed #000; padding: 15px; display: none; white-space: nowrap; z-index: 1 } -.fileinfo span, .fileinfo span * { font-size: 12px } -.fileinfo span em { display: inline-block; width: 70px; font-style: normal } -.fileinfo input:checked ~ span { display: block } +.page-dl table { margin: 0; border-collapse: collapse; } +.page-dl td { font-family: monospace; font-size: 80%; padding: 0 5px; } +.page-dl td:first-child { font-weight: bold } +.page-dl td a { font: inherit; line-height: inherit } +.page-dl dt a:target { font-weight: bold } +.page-dl dt a[href^="#"] { display: none; text-decoration: none; font-size: 80%; } +.page-dl dt:hover a[href^="#"] { display: inline } + +.dlinfo { text-decoration: none; color: #111199; font-size: 80% } code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ diff --git a/template.html b/template.html index 9e6dbae..15c7bb5 100644 --- a/template.html +++ b/template.html @@ -3,7 +3,7 @@ - +