From dc2272bce4f97e57dc3b7bdfbfb1c227aecbca35 Mon Sep 17 00:00:00 2001 From: Noah Pederson Date: Tue, 8 Sep 2026 18:54:46 -0500 Subject: [PATCH] Add update script for dir2opds, update dir2opds --- mkfile | 1 + pkgs/dir2opds/default.nix | 6 +++--- pkgs/dir2opds/update.rc | 40 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100755 pkgs/dir2opds/update.rc diff --git a/mkfile b/mkfile index c36f017..9852bcd 100644 --- a/mkfile +++ b/mkfile @@ -2,6 +2,7 @@ MKSHELL=rc update:V: ./pkgs/celld/update.rc & + ./pkgs/dir2opds/update.rc & ./pkgs/fx/update.rc & ./pkgs/janet-lsp/update.rc & ./pkgs/rcsh-language-server/update.rc & diff --git a/pkgs/dir2opds/default.nix b/pkgs/dir2opds/default.nix index 62622d4..a8f576d 100644 --- a/pkgs/dir2opds/default.nix +++ b/pkgs/dir2opds/default.nix @@ -6,13 +6,13 @@ buildGoModule { pname = "dir2opds"; - version = "unstable-2026-09-08"; + version = "0-unstable-2026-09-08"; src = fetchFromGitHub { owner = "chiefnoah"; repo = "dir2opds"; - rev = "bb565b260470ed651ee36afa1131623d31a10779"; - hash = "sha256-KXwhmlzBt+LwVGpJlghMpQ5aQOEAc+20LTn/zTYfklU="; + rev = "21ef6ded53d3f57404695e837dae10a8a11dd667"; + hash = "sha256-SbMndcHZ1+lUjG1SMBIlB5Tr8OwRBiv7VKxGxz4tLEQ="; }; vendorHash = "sha256-OdFSJrP44ir12dYiy4TwLuxKzOFwlTGbIszgqzVqvMw="; diff --git a/pkgs/dir2opds/update.rc b/pkgs/dir2opds/update.rc new file mode 100755 index 0000000..1d83686 --- /dev/null +++ b/pkgs/dir2opds/update.rc @@ -0,0 +1,40 @@ +#!/usr/bin/env rc +flag e + + +cd `{dirname $0} + +for(tool in awk git nix) { + if(! whatis $tool > /dev/null >[2=1]) { + echo 'error: required command not found: '$tool >[1=2] + exit 127 + } +} + +file=default.nix +repo=https://github.com/chiefnoah/dir2opds + +current=`{awk ' + $1 == "rev" { + gsub(/[";]/, "", $3) + print $3 + exit + } +' $file} +latest=`{git ls-remote $repo.git HEAD | awk 'NR == 1 { print $1 }'} + +if(! ~ $#current 1 || ! ~ $#latest 1) { + echo 'dir2opds: could not determine the current or latest revision' >[1=2] + exit 1 +} + +short_current=`{printf %.7s $current} +if(~ $current $latest) { + echo 'dir2opds: current ('$short_current^')' + exit 0 +} + +short_latest=`{printf %.7s $latest} +echo 'dir2opds: '$short_current' -> '$short_latest + +cd ../.. +nix run 'nixpkgs#nix-update' -- --flake --version=branch dir2opds -- 2.54.0