#!/bin/bash
# =============================================================================
# plugin/event/disks_mounted
#
# Official Unraid plugin event hook — NOT a custom mechanism. Unraid's
# emhttpd fires every executable found at
# /usr/local/emhttp/plugins/<name>/event/<eventname> as each boot/array
# event happens (see e.g. the real-world unassigned.devices plugin, which
# uses this same convention for its own disks_mounted/started/stopping_svcs
# hooks). This project relies exclusively on this official mechanism —
# specifically NOT on hand-editing /boot/config/go, which is unnecessary
# and easy to get wrong across plugin updates/uninstalls.
#
# "disks_mounted" fires once array disks AND cache pools are mounted —
# exactly the precondition unraid-podman needs before it can create/mount
# podman.img on the configured cache pool/disk (see
# docs/ARCHITECTURE.md section 4.3 and section 6.2).
#
# Backgrounded (& disown) so array startup / the Main GUI page isn't
# blocked on podman's full startup sequence (preflight, storage mount,
# service start, autostart chain) — mirrors how unassigned.devices
# backgrounds its own longer-running "started" hook.
# =============================================================================

/etc/rc.d/rc.podman start > /dev/null 2>&1 & disown
