[Tails-dev] live-persist: load kernel command line before ca…

Delete this message

Reply to this message
Autor: patapon
Data:  
Dla: tails-dev
Temat: [Tails-dev] live-persist: load kernel command line before calling Cmdline_old()
Hi all,

This is my first message on this list. I hope I'm doing this right :)

I've noticed that, in the /usr/local/sbin/live-persist script (l.517),
the function Cmdline_old() (from /lib/live/boot/9990-cmdline-old in
the live-boot package) was called but that the variable
LIVE_BOOT_CMDLINE it uses to get the actual kernel command line was
unset.

tl;dr: I've just written a very stupid patch (attached) that should
fix this.

Explanations:

As can be seen in /lib/live/boot/9990-main.sh (ll.19-20), the
typical usage is to initialize LIVE_BOOT_CMDLINE to /proc/cmdline, if
unset:

LIVE_BOOT_CMDLINE="${LIVE_BOOT_CMDLINE:-$(cat /proc/cmdline)}"
Cmdline_old

In fact, it comes from live-boot commit
a76532ce1ffc67df5f94b1483e53661756112584:

https://anonscm.debian.org/cgit/debian-live/live-boot.git/commit/?id=a76532ce1ffc67df5f94b1483e53661756112584

Before that commit, Arguments() (the ancestor of the Cmdline_old())
used to directly parse the command line from /proc/cmdline. That
commit changed this behavior, and from that point on, the caller of
Cmdline() then Cmdline_old() had to load the contents of /proc/cmdline
into a variable (_CMDLINE, then LIVE_BOOT_CMDLINE).

Thanks & cheers!
patapon.
>From 8fb0957d5fd5c638fcefc0d217f46c8f1e9cf3b8 Mon Sep 17 00:00:00 2001
From: patapon <patapon@???>
Date: Sun, 26 Nov 2017 23:35:29 +0100
Subject: [PATCH] live-persist: load kernel command line before calling
Cmdline_old().

---
config/chroot_local-includes/usr/local/sbin/live-persist | 1 +
1 file changed, 1 insertion(+)

diff --git a/config/chroot_local-includes/usr/local/sbin/live-persist b/config/chroot_local-includes/usr/local/sbin/live-persist
index d8fc9c82ad..2e91fc1f06 100755
--- a/config/chroot_local-includes/usr/local/sbin/live-persist
+++ b/config/chroot_local-includes/usr/local/sbin/live-persist
@@ -514,6 +514,7 @@ main ()
     BASH_XTRACEFD="3"


     # parse the kernel cmdline for live-boot's configuration as defaults
+    : ${LIVE_BOOT_CMDLINE:=$(cat /proc/cmdline)}
     Cmdline_old


     # note that this is not enough for disabling tracing. we need to do the
-- 
2.11.0