Subject: [alpine-devel] [PATCH] init: make init a /proc/cmdline option

From: Jesse Young <[email-masked]>
Date: Sat, 29 Aug 2015 12:13:22 -0500

---
 initramfs-init.in | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/initramfs-init.in b/initramfs-init.in
index 934fe92..aa68db5 100755
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -386,8 +386,8 @@ find_boot_repositories() {
 set -- $(cat /proc/cmdline)
 
 myopts="alpine_dev autodetect autoraid chart cryptroot cryptdm debug_init
-	dma init_args keep_apk_new modules ovl_dev pkgs quiet root_size root
-	usbdelay ip alpine_repo apkovl alpine_start splash blacklist
+	dma init init_args keep_apk_new modules ovl_dev pkgs quiet root_size
+	root usbdelay ip alpine_repo apkovl alpine_start splash blacklist
 	overlaytmpfs rootfstype rootflags"
 
 for opt; do
@@ -566,7 +566,7 @@ if [ -n "$KOPT_root" ]; then
 		fi
 	done
 	sync
-	exec /bin/busybox switch_root $sysroot $chart_init /sbin/init $KOPT_init_args
+	exec /bin/busybox switch_root $sysroot $chart_init ${KOPT_init:-/sbin/init} $KOPT_init_args
 	echo "initramfs emergency recovery shell launched"
 	exec /bin/busybox sh
 fi
@@ -825,9 +825,9 @@ if [ "$KOPT_chart" = yes ]; then
 	chart_init="/sbin/bootchartd start-rootfs"
 fi
 
-if [ ! -x $sysroot/sbin/init ]; then
+if [ ! -x "${sysroot}${KOPT_init:-/sbin/init}" ]; then
 	[ "$KOPT_splash" != "no" ] && echo exit > $sysroot/$splashfile
-	echo "/sbin/init not found in new root. Launching emergency recovery shell"
+	echo "${KOPT_init:-/sbin/init} not found in new root. Launching emergency recovery shell"
 	echo "Type exit to continue boot."
 	/bin/busybox sh
 fi
@@ -843,7 +843,7 @@ sync
 
 [ "$KOPT_splash" = "init" ] && echo exit > $sysroot/$splashfile
 echo ""
-exec /bin/busybox switch_root $sysroot $chart_init /sbin/init $KOPT_init_args
+exec /bin/busybox switch_root $sysroot $chart_init ${KOPT_init:-/sbin/init} $KOPT_init_args
 
 [ "$KOPT_splash" != "no" ] && echo exit > $sysroot/$splashfile
 echo "initramfs emergency recovery shell launched"
-- 
2.5.0

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---