Throw file checksums on a separate page + ncdu link updates

This commit is contained in:
Yorhel 2024-07-19 10:44:13 +02:00
parent 1d11b8da83
commit 2196b2fbd4
9 changed files with 104 additions and 103 deletions

2
.gitignore vendored
View file

@ -1,6 +1,7 @@
*.zip *.zip
*.gz *.gz
*.pdf *.pdf
dat/download.md
dat/globster/api.md dat/globster/api.md
dat/globster/api.pod dat/globster/api.pod
dat/globster/ctl.md dat/globster/ctl.md
@ -59,6 +60,7 @@ pub/doc/pwlookup.html
pub/doc/sqlaccess.html pub/doc/sqlaccess.html
pub/doc/sqlobject.html pub/doc/sqlobject.html
pub/doc/vndbtitles.html pub/doc/vndbtitles.html
pub/download.html
pub/dump.html pub/dump.html
pub/dump/awshrink.html pub/dump/awshrink.html
pub/dump/btrfssize.html pub/dump/btrfssize.html

View file

@ -26,6 +26,7 @@ PAGES=\
"doc/sqlaccess.md"\ "doc/sqlaccess.md"\
"doc/sqlobject.md"\ "doc/sqlobject.md"\
"doc/vndbtitles.md"\ "doc/vndbtitles.md"\
"download.dl"\
"dump.md"\ "dump.md"\
"dump/awshrink.md"\ "dump/awshrink.md"\
"dump/btrfssize.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) 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 # 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 .PHONY: all clean
@ -121,7 +122,7 @@ ${FEEDS}: mkfeed.pl dat/index.md
${FETCH}: dat/%: ${FETCH}: dat/%:
@echo "FETCH $*" @echo "FETCH $*"
@mkdir -p $$(dirname "$@") @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 # 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 ${HTML_OUT}: pub/%.html: dat/%.md template.html
@echo "HTML $*" @echo "HTML $*"
@mkdir -p $$(dirname "$@") @mkdir -p $$(dirname "$@")
@cat "$<" |\ @cat "$<" |\
./dllink.pl |\ sed -E 's/\[([^]]+)\]\(\/download\/([^\) ]+)\)/\0 <a class="dlinfo" title="File info" href="\/download#\2">ⓘ<\/a>/g' |\
pandoc -f markdown -t html5 --strip-comments --template template.html \ pandoc -f markdown -t html5 --strip-comments --template template.html \
--metadata path1=$$(echo "$*" | sed 's/\/.*//') \ --metadata path1=$$(echo "$*" | sed 's/\/.*//') \
--metadata path2=$$(echo "$*" | sed 's/\//-/' | sed 's/\/.*//') \ --metadata path2=$$(echo "$*" | sed 's/\//-/' | sed 's/\/.*//') \

View file

@ -17,15 +17,13 @@ Static binaries
[AArch64](/download/ncdu-2.4-linux-aarch64.tar.gz). [AArch64](/download/ncdu-2.4-linux-aarch64.tar.gz).
Zig version (stable) 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 Requires Zig 0.12 or 0.13.
motivation for the rewrite and some of the differences with the C version.
Note that the [Zig language](https://ziglang.org/) and compiler are still The [Zig language](https://ziglang.org/) and compiler are still somewhat
very much unstable. This version of ncdu will *only* work with the version unstable, use the ncdu 1.x branch if this does not work for you or if you
of the Zig compiler noted above. Use the ncdu 1.x branch if this does not need a more stable compilation environment.
work for you or if you need a more stable compilation environment.
C version (LTS) C version (LTS)
: 1.20 ([ncdu-1.20.tar.gz](/download/ncdu-1.20.tar.gz) - [changes](/ncdu/changes)) : 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. but is still being maintained and perfectly usable.
Development version Development version
: The most recent code is available on a git repository and can be cloned : The most recent code is available on git:
with `git clone git://g.blicky.net/ncdu.git/`. The repository is also ```
available for [online browsing](https://code.blicky.net/yorhel/ncdu/) (and git clone git://g.blicky.net/ncdu.git/
[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 repository is also available for online browsing on
the 'zig' branch. [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 License
: MIT. : 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: 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) - [AIX](http://www.perzl.org/aix/index.php?n=Main.Ncdu) -
[Alpine Linux](http://pkgs.alpinelinux.org/packages?name=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](http://sisyphus.ru/en/srpm/ncdu) - [ALT Linux](https://packages.altlinux.org/en/sisyphus/srpms/ncdu/) -
[Arch Linux](https://www.archlinux.org/packages/?q=ncdu) - [Arch Linux](https://www.archlinux.org/packages/?q=ncdu) -
[CRUX](https://crux.nu/portdb/?q=ncdu&a=search) - [CRUX](https://crux.nu/portdb/?q=ncdu&a=search) -
[Cygwin](https://cygwin.com/cgi-bin2/package-grep.cgi?grep=ncdu) - [Cygwin](https://cygwin.com/cgi-bin2/package-grep.cgi?grep=ncdu) -
[Debian](http://packages.debian.org/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) - [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) - [Frugalware](https://frugalware.org/package/ncdu/) -
[Gentoo](https://packages.gentoo.org/packages/sys-fs/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/) - [GNU Guix](https://guix.gnu.org/packages/N/) -
[NixOS](https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/misc/ncdu/default.nix) - [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) - [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)) - 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)) -
[Puppy Linux](http://www.murga-linux.com/puppy/viewtopic.php?t=35024) - [Solaris](https://www.opencsw.org/packages/ncdu) -
[Solaris](http://www.opencsw.org/packages/ncdu) - [Slackware](https://slackbuilds.org/repository/15.0/system/ncdu/) -
[Slackware](http://slackbuilds.org/repository/14.2/system/ncdu/) - [Ubuntu](https://packages.ubuntu.com/search?searchon=sourcenames&keywords=ncdu) -
[Slax Linux](http://www.slax.org/modules.php?detail=ncdu) - [Void Linux](https://voidlinux.org/packages/?arch=x86_64&q=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).
Packages for NetBSD, DragonFlyBSD, MirBSD and others can be found on Packages for NetBSD, DragonFlyBSD, MirBSD and others can be found on
[pkgsrc](http://pkgsrc.se/sysutils/ncdu). [pkgsrc](http://pkgsrc.se/sysutils/ncdu).
A port to z/OS is available [here](https://dovetail.com/community/ncdu.html).
## Similar projects ## Similar projects
- [Duc](http://duc.zevv.nl/) - Multiple user interfaces. There's no shortage of alternatives to ncdu nowadays. In no particular order:
- [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. - [Duc](http://duc.zevv.nl/) - Multiple user interfaces, C, scales beyond directories that fit in RAM.
- [dua](https://github.com/Byron/dua-cli) - Rust disk usage analyzer with a CLI. - [gt5](http://gt5.sourceforge.net/) - TUI/HTML, also supports diffing.
- [diskonaut](https://github.com/imsnif/diskonaut) - Rust disk usage analyzer with a TUI. - [gdu](https://github.com/dundee/gdu) - TUI/CLI, Go, supports ncdu JSON export and import.
- [godu](https://github.com/viktomas/godu) - Another Go disk usage analyzer, with a slightly different browser UI. - [dua](https://github.com/Byron/dua-cli) - CLI, Rust.
- [tdu](https://bitbucket.org/josephpaul0/tdu) - Go command-line tool with ncdu JSON export. - [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. - [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. - [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, with a treemap display. - [GdMap](http://gdmap.sourceforge.net/) - GTK, treemap.
- [Filelight](https://apps.kde.org/filelight/) - KDE, using pie-charts. - [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. - [K4DirStat](https://github.com/jeromerobert/k4dirstat) - Qt, treemap.
- [xdiskusage](http://xdiskusage.sourceforge.net/) - FLTK, with a treemap display. - [xdiskusage](http://xdiskusage.sourceforge.net/) - FLTK, with a treemap display.
- [fsv](http://fsv.sourceforge.net/) - 3D visualization. - [fsv](http://fsv.sourceforge.net/) - 3D visualization.

View file

@ -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; <F> }
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 '<em>PGP:</em> <a href="/download/%s.asc">%1$s.asc</a>', $fn if -e "$fn.asc";
push @info, sprintf '<em>MD5:</em> <code>%s</code>', (slurp "$fn.md5") =~ /^([^ ]+)/ if -e "$fn.md5";
push @info, sprintf '<em>SHA1:</em> <code>%s</code>', (slurp "$fn.sha1") =~ /^([^ ]+)/ if -e "$fn.sha1";
push @info, sprintf '<em>SHA-256:</em> <code>%s</code>', (slurp "$fn.sha256") =~ /^([^ ]+)/ if -e "$fn.sha256";
return $code if !@info;
unshift @info, sprintf '<em>Size:</em> %s (%s bytes)', size(-s $fn), fullsize(-s $fn);
unshift @info, sprintf '<em>File:</em> <a href="/download/%s">%1$s</a>', $fn;
$id = sprintf 'fileinfo_%d', rand 1<<32;
qq{<span class="fileinfo">}
. qq{<input id="$id" type="checkbox">}
. qq{<span>}
. qq{<label for="$id">close</label>}
. join('<br>', @info)
. qq{</span>}
. $code
. qq{ <label for="$id"><img src="/img/info.svg"></label>}
.qq{</span>}
}
BEGIN { chdir 'pub/download' }
s{\[([^\]]+)\]\(/download/([^\) ]+)\)}{file $&,$1,$2}eg;

42
mkdlpage.pl Executable file
View file

@ -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:<br>';
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{<a id="$fn" href="/download/$fn">$fn</a> <a href="#$fn">🔗</a>};
say ": <table>";
say " <tr><td>Size </td><td>$fullsize bytes ($size)</td></tr>";
say ' <tr><td>MD5 </td><td>'.hash("$fn.md5").'</td></tr>';
say ' <tr><td>SHA1 </td><td>'.hash("$fn.sha1").'</td></tr>';
say ' <tr><td>SHA256</td><td>'.hash("$fn.sha256").'</td></tr>';
say " <tr><td>PGP </td><td><a href=\"/download/$fn.asc\">asc</a></td></tr>";
say ' </table>';
say '';
}

View file

@ -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] RewriteRule ^yxml/bug.*$ https://code.blicky.net/yorhel/yxml/issues [L,R=permanent]
# No trailing slash (except for the download/ directory index) # No trailing slash (except for the download/ directory index)
RewriteCond %{REQUEST_URI} !^/download #RewriteCond %{REQUEST_URI} !^/download
RewriteRule ^(.+)/$ $1 [L,R=permanent] RewriteRule ^(.+)/$ $1 [L,R=permanent]
RewriteCond %{REQUEST_FILENAME}.html -s RewriteCond %{REQUEST_FILENAME}.html -s

View file

@ -1,2 +0,0 @@
Options +Indexes
DirectorySlash on

View file

@ -23,10 +23,9 @@ header li a.small { font-size: 10px }
header li a.external:after { content: url(/img/external.gif) } header li a.external:after { content: url(/img/external.gif) }
header li a.fwd:after { content: ' »' } header li a.fwd:after { content: ' »' }
header li a.back:before { 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, header p * { font-size: 9px; text-decoration: none; line-height: 1.8em }
header p a:hover { text-decoration: underline } 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 } header p b { display: block; margin-top: 10px; margin-bottom: 2px }
@media (min-width: 1200px) { @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 > ul > li { margin-bottom: 1.3em }
.page-changelog li li { margin-left: 1em } .page-changelog li li { margin-left: 1em }
.fileinfo { position: relative } .page-dl table { margin: 0; border-collapse: collapse; }
.fileinfo input { display: none } .page-dl td { font-family: monospace; font-size: 80%; padding: 0 5px; }
.fileinfo label { cursor: pointer } .page-dl td:first-child { font-weight: bold }
.fileinfo label img { height: 12px } .page-dl td a { font: inherit; line-height: inherit }
.fileinfo span label { position: absolute; right: 0; top: 0; padding: 5px } .page-dl dt a:target { font-weight: bold }
.fileinfo span { position: absolute; top: 25px; left: -80px; background: #eee; border: 1px dashed #000; padding: 15px; display: none; white-space: nowrap; z-index: 1 } .page-dl dt a[href^="#"] { display: none; text-decoration: none; font-size: 80%; }
.fileinfo span, .fileinfo span * { font-size: 12px } .page-dl dt:hover a[href^="#"] { display: inline }
.fileinfo span em { display: inline-block; width: 70px; font-style: normal }
.fileinfo input:checked ~ span { display: block } .dlinfo { text-decoration: none; color: #111199; font-size: 80% }
code span.al { color: #ff0000; font-weight: bold; } /* Alert */ code span.al { color: #ff0000; font-weight: bold; } /* Alert */
code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */ code span.an { color: #60a0b0; font-weight: bold; font-style: italic; } /* Annotation */

View file

@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes"> <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<link rel="stylesheet" href="/style.css?2" type="text/css" media="all" /> <link rel="stylesheet" href="/style.css?3" type="text/css" media="all" />
<link rel="alternate" type="application/atom+xml" href="/feed.atom" title="Site updates" /> <link rel="alternate" type="application/atom+xml" href="/feed.atom" title="Site updates" />
<style type="text/css"> <style type="text/css">
header .item1-$path1$, header .item2-$path2$, header .item3-$path3$ { color: #03a } header .item1-$path1$, header .item2-$path2$, header .item3-$path3$ { color: #03a }
@ -149,14 +149,6 @@
<a href="https://yorhel.nl/">home</a> <a href="https://yorhel.nl/">home</a>
- <a href="https://g.blicky.net/">git</a> - <a href="https://g.blicky.net/">git</a>
- <a href="https://lonely.town/@ayo">@ayo</a> - <a href="https://lonely.town/@ayo">@ayo</a>
<br>
<b>= pgp =</b>
only used for releases
<br>
<a href="https://yorhel.nl/key.asc">key</a>
- <a href="http://pgp.mit.edu:11371/pks/lookup?search=0x8c2739fa">mit</a>
<br>
<i>7446 0D32 B808 10EB A9AF A2E9 6239 4C69 8C27 39FA</i>
</p> </p>
<img id="scissors" src="/img/scissors.png" alt="Cute decorative scissors, cutting through your code."> <img id="scissors" src="/img/scissors.png" alt="Cute decorative scissors, cutting through your code.">