From ac5324d3f054930f49798094ba8730ca1f3f49ca Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Wed, 13 Nov 2013 21:07:12 +0100 Subject: [PATCH] linuxrc: fix check against REAL_INIT and FAKE_INIT Prioritize the latter (init=) if it's set and no real_init= is set. This, while keeping backward compatibility, makes possible to directly use init= to boot the preferred init system. --- defaults/initrd.d/00-rootdev.sh | 6 +++++- defaults/linuxrc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/defaults/initrd.d/00-rootdev.sh b/defaults/initrd.d/00-rootdev.sh index 3af2e58..d989651 100755 --- a/defaults/initrd.d/00-rootdev.sh +++ b/defaults/initrd.d/00-rootdev.sh @@ -153,7 +153,11 @@ real_root_init() { if [ -z "${REAL_ROOT}" ] && [ "${FAKE_ROOT}" != "/dev/ram0" ]; then REAL_ROOT="${FAKE_ROOT}" fi - if [ -z "${REAL_INIT}" ] && [ "${FAKE_INIT}" != "/linuxrc" ]; then + if [ -z "${REAL_INIT}" ] && [ -z "${FAKE_INIT}" ]; then + # if none of REAL_INIT and FAKE_INIT is set, default + # to /sbin/init + REAL_INIT="/sbin/init" + elif [ -z "${REAL_INIT}" ] && [ "${FAKE_INIT}" != "/linuxrc" ]; then REAL_INIT="${FAKE_INIT}" fi if [ -z "${REAL_ROOTFLAGS}" ]; then diff --git a/defaults/linuxrc b/defaults/linuxrc index 47db968..48ae691 100755 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -31,7 +31,7 @@ PATH="${PATH}:/sbin:/usr/sbin" CMDLINE=$(cat /proc/cmdline) FAKE_ROOT="" FAKE_INIT="" -REAL_INIT="/sbin/init" +REAL_INIT="" FAKE_ROOTFLAGS="" INIT_OPTS="" CRYPT_SILENT=0