shutdown-oneshots.d — package-provided stage-3 *-stop oneshots
==============================================================

Under native runit boot (/etc/runit/native.boot.run, from runit-init),
/etc/runit/3 runs shutdown as:

  1. shutdown-run/05-shutdown-oneshots.sh   (NN 00–49)
  2. if shutdown-run has other *.sh (umount/halt/…): source those
     else: run_sysv_scripts on rc0.d / rc6.d   ← same SysV fallback as before
  3. shutdown-run/85-shutdown-oneshots-late.sh (NN 50–99)

The SysV path lives in /etc/runit/3 (the else).  Do not put a sysv
wrapper inside shutdown-run — that would duplicate it.  When umount/halt
are migrated, add them as NN-*.sh under shutdown-run; then stage 3 skips
SysV and uses those instead (runit puro).

runit-init ships only the oneshot helpers:

  05-shutdown-oneshots.sh
  85-shutdown-oneshots-late.sh

At steps 05 / 85, each executable in /etc/runit/shutdown-oneshots.d/
is run in lexical order within its NN band:

  /etc/runit/shutdown-oneshots.d/NN-servicename-stop

NN is two digits (shutdown order).  Packages ship these as symlinks:

  /etc/sv/<servicename>-stop/run  →  /etc/runit/shutdown-oneshots.d/NN-<servicename>-stop

All *-stop oneshots MUST ship a static ./down and stay disabled
(oneshots-not-in-runsvdir) so runsv never auto-starts them.

Shebangs
--------

  /etc/sv/<name>-stop/run:

    #!/usr/bin/env /lib/runit/invoke-run

    Same convention as boot oneshots.  05/85 run via "sv once" or
    "(cd /etc/sv/<name>-stop && ./run)" so PWD is the service directory.

  /etc/runit/shutdown-run/*.sh:

    Do NOT use invoke-run.  Stage 3 sources these files.  Use #!/bin/sh
    (or no shebang) and return, never exit.

Relation to boot models
-----------------------

1) exit + *-stop  → register here (shutdown-oneshots.d)
2) pause + ./finish → no *-stop entry; finish runs on force-stop in stage 3

Number ranges (policy — keep gaps for local admin 9x):

  00–09  early / local admin
  10–19  save state & app stops     (alsa-utils, tuptime, acpi-support,
                                     schroot, ufw, …)
  20–29  networking / resolvconf
  40–49  urandom, hwclock, rc.local
  50–59  cryptdisks (AFTER umount — SysV else or native shutdown-run)
  60–79  post-umount (live-tools medium eject, …)
  90–99  local admin (late)

See also /usr/share/doc/runit/boot-oneshots.d.txt.
