| Date: Sat, 18 Sep 2010 20:47:16 +0200
special case for 9vx -i without root
Diffstat:
M doc/9vx.1 | 6 ++++--
M src/9vx/cpurc | 4 ++--
M src/9vx/main.c | 23 +++++++++++++++++++----
3 files changed, 25 insertions(+), 8 deletions(-)
--- |
| @@ -101,9 +101,11 @@ Do not fork at init
Do not start the gui
.TP
.BI -i
-Run rc(1) instead of init (sets
+If there is no root, boot from
+.I rootfs.bz2
+and run rc(1), else set
.I init=/386/init -tm
-)
+(see init(8))
.TP
.BI -t
Use tty for input/output |
| @@ -51,6 +51,10 @@ int nocpuload;
char* argv0;
char* conffile = "9vx";
char* defaultroot = "local!/boot/rootfs.bz2";
+char* defaultinit = "\
+/386/bin/bind -a /386/bin /bin; \
+/386/bin/bind -a /rc/bin /bin; \
+/386/bin/rc -i";
Conf conf;
static Mach mach0;
@@ -527,10 +531,21 @@ init0(void)
ksetenv("user", username, 0);
ksetenv("sysname", "vx32", 0);
inifields(&inienv);
- if(initrc != 0)
- inienv("init", "/386/init -tm");
- else if(initcmd)
- inienv("init", smprint("/386/init -t '. /rc/bin/termrc; home=/usr/$user; cd; %s; reboot'", initcmd));
+
+ if(initrc != 0){
+ if(localroot == nil && bootargc == 0){
+ inienv("nobootprompt", defaultroot);
+ inienv("initcmd", defaultinit);
+ inienv("init", "/386/bin/rc -c 'eval $initcmd'");
+ }
+ else
+ inienv("init", "/386/init -tm");
+ }
+ else if(initcmd){
+ ksetenv("initcmd", initcmd, 0);
+ inienv("init", "/386/init -t '. /rc/bin/termrc; home=/usr/$user;\
+ test -d $home && cd; rc -c $initcmd; reboot'");
+ }
if(localroot)
inienv("nobootprompt", nobootprompt(localroot));
inienv("cputype", "386"); |