diff --git a/init_functions b/init_functions index d5a584e..7287086 100644 --- a/init_functions +++ b/init_functions @@ -47,6 +47,19 @@ poll_device() { } launch_interactive_shell() { + if [ -n "$rd_noninteractive" ]; then + printf '%s\n' \ + "************** REBOOT REQUIRED **************" \ + "* *" \ + "* running in non-interactive mode *" \ + "* - *" \ + "* automatically restarting in 2 seconds *" \ + "* *" \ + "*********************************************" + sleep 2 + reboot -f + fi + export PS1='[rootfs \W]\$ ' # explicitly redirect to /dev/console in case we're logging. note that @@ -174,6 +187,9 @@ parse_cmdline_item() { rd_logmask=$(( _rdlog_kmsg | _rdlog_cons )) fi ;; + rd.noninteractive) + rd_noninteractive=y + ;; [![:alpha:]_]*|[[:alpha:]_]*[![:alnum:]_]*) # invalid shell variable, ignore it ;; diff --git a/man/mkinitcpio.8.txt b/man/mkinitcpio.8.txt index 5c3118e..d9410dc 100644 --- a/man/mkinitcpio.8.txt +++ b/man/mkinitcpio.8.txt @@ -292,6 +292,9 @@ the kernel command line: *all*;; Writes output to all known log targets. +*rd.noninteractive*:: + If specified, reboot the machine instead of starting an interactive shell. + These are only the variables that the core of mkinitcpio honor. Additional hooks may look for other environment variables and should be documented by the help output for the hook. diff --git a/test/test_parse_cmdline b/test/test_parse_cmdline index ff855e4..9249962 100755 --- a/test/test_parse_cmdline +++ b/test/test_parse_cmdline @@ -217,6 +217,8 @@ test_parse 'rd.log=kmsg' \ 'rd_logmask' '2' test_parse 'rd.log=file' \ 'rd_logmask' '1' +test_parse 'rd.noninteractive' \ + 'rd_noninteractive' 'y' # a mix of stuff test_parse 'foo=bar bareword bar="ba az"' \