RFC: make init(8) aware of /rescue/sh
Rui Paulo
rpaulo at me.com
Wed Feb 11 18:55:38 UTC 2015
On Feb 11, 2015, at 02:31 AM, perryh at pluto.rain.com (Perry Hutchison) wrote:
Seems to me it might be desirable for init(8) to fall back
to /rescue/sh for single-user mode if neither the default
(kenv:init_shell) nor /bin/sh is usable. Thoughts?
(Patch generated against stable/8, but will likely apply to
HEAD also -- not much has changed in init.)
--- init.c-orig
+++ init.c
@@ -79,6 +79,9 @@
#include <login_cap.h>
#endif
+/* Ideally this value should come from the RESCUE side of paths.h */
+#define _PATH_R_BSHELL "/rescue/sh"
+
#include "pathnames.h"
/*
@@ -706,7 +709,8 @@
/*
* Fire off a shell.
- * If the default one doesn't work, try the Bourne shell.
+ * If the default one doesn't work, try the Bourne shell;
+ * if that doesn't work either, try the rescue shell.
*/
char name[] = "-sh";
@@ -717,6 +721,8 @@
emergency("can't exec %s for single user: %m", shell);
execv(_PATH_BSHELL, argv);
emergency("can't exec %s for single user: %m", _PATH_BSHELL);
+ execv(_PATH_R_BSHELL, argv);
+ emergency("can't exec %s for single user: %m", _PATH_R_BSHELL);
sleep(STALL_TIMEOUT);
_exit(1);
}
This makes sense to me. :-)
More information about the freebsd-hackers
mailing list