From e7538a42ad27ef3a4caf4042db6004306d0a12ac Mon Sep 17 00:00:00 2001 From: SFG545 Date: Mon, 16 Mar 2026 23:32:51 -0500 Subject: [PATCH] refactor: remove deferred hook handling from lifecycle script execution --- src/install/scripts.rs | 45 ++++++------------------------------------ 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/src/install/scripts.rs b/src/install/scripts.rs index af4fff1..cae73b3 100644 --- a/src/install/scripts.rs +++ b/src/install/scripts.rs @@ -270,7 +270,6 @@ pub fn run_hook_if_present( ); } } - HookRunOutcome::Deferred => {} } Ok(true) @@ -278,7 +277,6 @@ pub fn run_hook_if_present( enum HookRunOutcome { Ran(std::process::ExitStatus), - Deferred, } #[derive(Default)] @@ -432,21 +430,12 @@ fn run_script_with_rootfs_context( return Ok(HookRunOutcome::Ran(status)); } - // Post hooks can be deferred until the target shell exists and chroot - // execution is available. - if matches!( - hook, - Hook::PostInstall | Hook::PostUpdate | Hook::PostRemove - ) { - enqueue_deferred_hook(rootfs, pkg_name, hook, rel)?; - crate::log_warn!( - "Deferred lifecycle hook {} for {} until {} has /bin/sh", - hook.canonical_name(), - pkg_name, - rootfs.display() - ); - return Ok(HookRunOutcome::Deferred); - } + crate::log_warn!( + "Running lifecycle hook {} for {} without chroot because {} has no /bin/sh", + hook.canonical_name(), + pkg_name, + rootfs.display() + ); } // Fallback (non-root / no rootfs shell / script outside rootfs): @@ -595,28 +584,6 @@ fn write_deferred_hooks(path: &Path, hooks: &[DeferredHook]) -> Result<()> { Ok(()) } -fn enqueue_deferred_hook( - rootfs: &Path, - pkg_name: &str, - hook: Hook, - script_rel: &Path, -) -> Result<()> { - let path = deferred_hooks_file(rootfs); - let mut hooks = read_deferred_hooks(&path)?; - if hooks - .iter() - .any(|h| h.pkg_name == pkg_name && h.hook == hook && h.script_rel == script_rel) - { - return Ok(()); - } - hooks.push(DeferredHook { - pkg_name: pkg_name.to_string(), - hook, - script_rel: script_rel.to_path_buf(), - }); - write_deferred_hooks(&path, &hooks) -} - /// Attempt to run deferred lifecycle hooks for this rootfs once. /// /// Deferred hooks are best-effort: failures are kept in queue for later retry.