Source: live-boot Version: 1:20170623 Severity: wishlist Tags: patch Hi,
initramfs-tools support hooks for top, premount, bottom when booting with boot=local or boot=nfs. Please add similar support to live-boot when booting with boot=live. A patch (for git) is attached. -- Benjamin Drung System Developer Debian & Ubuntu Developer ProfitBricks GmbH Greifswalder Str. 207 D - 10405 Berlin Email: benjamin.dr...@profitbricks.com URL: https://www.profitbricks.de Sitz der Gesellschaft: Berlin Registergericht: Amtsgericht Charlottenburg, HRB 125506 B Geschäftsführer: Achim Weiss, Matthias Steinberg
>From 11ccfa795851a5652a55fec37c059864c7951458 Mon Sep 17 00:00:00 2001 From: Benjamin Drung <benjamin.dr...@profitbricks.com> Date: Wed, 13 Dec 2017 18:40:37 +0100 Subject: [PATCH] Support live-{top,premount,bottom} hooks initramfs-tools support hooks for top, premount, bottom when booting with boot=local or boot=nfs. Add similar support to live-boot when booting with boot=live. Signed-off-by: Benjamin Drung <benjamin.dr...@profitbricks.com> --- backend/initramfs-tools/live.script | 56 +++++++++++++++++++++++++++++++++---- components/9990-initramfs-tools.sh | 22 +++++++++++++++ 2 files changed, 73 insertions(+), 5 deletions(-) diff --git a/backend/initramfs-tools/live.script b/backend/initramfs-tools/live.script index ff2915a..5bec741 100755 --- a/backend/initramfs-tools/live.script +++ b/backend/initramfs-tools/live.script @@ -1,13 +1,59 @@ -#!/bin/sh - -#set -e +# Live system filesystem mounting -*- shell-script -*- . /bin/live-boot -. /scripts/functions +live_top() +{ + if [ "${live_top_used}" != "yes" ]; then + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-top" + run_scripts /scripts/live-top + [ "$quiet" != "y" ] && log_end_msg + fi + live_top_used=yes +} + +live_premount() +{ + if [ "${live_premount_used}" != "yes" ]; then + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-premount" + run_scripts /scripts/live-premount + [ "$quiet" != "y" ] && log_end_msg + fi + live_premount_used=yes +} + +live_bottom() +{ + if [ "${live_premount_used}" = "yes" ] || [ "${live_top_used}" = "yes" ]; then + [ "$quiet" != "y" ] && log_begin_msg "Running /scripts/live-bottom" + run_scripts /scripts/live-bottom + [ "$quiet" != "y" ] && log_end_msg + fi + live_premount_used=no + live_top_used=no +} + -mountroot () +mountroot() { # initramfs-tools entry point for live-boot is mountroot(); function Live } + +mount_top() +{ + # Note, also called directly in case it's overridden. + live_top +} + +mount_premount() +{ + # Note, also called directly in case it's overridden. + live_premount +} + +mount_bottom() +{ + # Note, also called directly in case it's overridden. + live_bottom +} diff --git a/components/9990-initramfs-tools.sh b/components/9990-initramfs-tools.sh index eb11d23..241c620 100755 --- a/components/9990-initramfs-tools.sh +++ b/components/9990-initramfs-tools.sh @@ -73,3 +73,25 @@ panic() . /scripts/functions panic "$@" } + +# Note: Other components source /scripts/functions before sourcing this file. +# /scripts/functions overrides the mount_* functions (to no-ops). Thus fix +# the mount_* options here again. + +mount_top() +{ + # Note, also called directly in case it's overridden. + live_top +} + +mount_premount() +{ + # Note, also called directly in case it's overridden. + live_premount +} + +mount_bottom() +{ + # Note, also called directly in case it's overridden. + live_bottom +} -- 2.14.1