commit 020b2171632dae815746bcd497df0cb1680f573c
parent 5174fd291ea1a6da107b1d52cdeb328cc13c6530
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date: Wed, 15 Sep 2010 02:08:43 +0200
add -e option to exec commands in a properly set terminal
Diffstat:
4 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/doc/9vx.1 b/doc/9vx.1
@@ -22,6 +22,9 @@
.I -u user
]
[
+.I -e initcmd
+]
+[
.I bootargs
]
.PP
@@ -39,6 +42,9 @@
.I -u user
]
[
+.I -e initcmd
+]
+[
.I bootargs
]
.SH DESCRIPTION
@@ -61,12 +67,12 @@ option (see below).
One or more
.I bootargs
arguments will be passed to boot/boot as explained in boot(8), with the addition that
-the local method also supports local directories.
+the local method also supports local directories, as well as kfs and fossil disk files.
The
.I -r
option sets
.I nobootprompt=local!#Z/localroot
-to boot from a local directory containing a Plan 9 tree
+to boot from a local directory or file containing a Plan 9 tree
(the host file server can be accessed
from inside through
.I #Z,
@@ -76,6 +82,11 @@ unless localroot is set to
If an
.I user
is not specified, the current user in the host operating system will be used.
+The option
+.I -e
+can be used to boot a terminal and run
+.I initcmd
+instead of $home/lib/profile.
Other options are:
.nr xx \w'\fL-m\f2name\ \ '
.TP \n(xxu
@@ -143,6 +154,7 @@ pairs in a similar fasion to plan9.ini(8). Additional options are
.I macaddr
(that can also be part of a netdev line),
.I localroot.
+.I initcmd.
and
.I service
.SS Exiting 9vx
@@ -161,8 +173,6 @@ The menu system of plan9.ini(8) is not supported in
.I 9vx.ini
files.
.P
-kfs file systems are not supported by the included boot/boot
-.P
.I 9vx
is not so stable as native Plan9 systems.
.SH "SEE ALSO"
diff --git a/src/9vx/conf.c b/src/9vx/conf.c
@@ -157,6 +157,8 @@ iniopt(char *name, char *value)
localroot = value;
else if(strcmp(name, "user") == 0 && !username)
username = value;
+ else if(strcmp(name, "initcmd") == 0 && !initcmd)
+ initcmd = value;
}
void
@@ -195,6 +197,8 @@ printconfig(char *argv0){
else if(!fsdev)
print(" -r -");
print(" -u %s", username);
+ if(initcmd)
+ print(" -e %s", initcmd);
for(i = 0; i < bootargc; i++)
print(" %s", bootargv[i]);
print("\n");
diff --git a/src/9vx/conf.h b/src/9vx/conf.h
@@ -13,6 +13,7 @@ int usetty; /* use tty for input/output */
int memmb; /* memory size in mb */
int bootargc;
char** bootargv;
+char* initcmd;
char* inifile;
char* localroot;
char* username;
diff --git a/src/9vx/main.c b/src/9vx/main.c
@@ -71,7 +71,7 @@ void
usage(void)
{
// TODO(yy): add debug and other options by ron
- fprint(2, "usage: 9vx [-p file.ini] [-fgit] [-l cpulimit] [-m memsize] [-n [tap] netdev] [-a macaddr] [-r root] [-u user] [bootargs]\n");
+ fprint(2, "usage: 9vx [-p file.ini] [-cfgit] [-l cpulimit] [-m memsize] [-n [tap] netdev] [-a macaddr] [-r root] [-u user] [-e initcmd] [bootargs]\n");
exit(1);
}
@@ -144,6 +144,9 @@ main(int argc, char **argv)
case 'c':
cpuserver = 1;
break;
+ case 'e':
+ initcmd = EARGF(usage());
+ break;
case 'f':
nofork = 1;
break;
@@ -528,6 +531,8 @@ init0(void)
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(localroot)
inienv("nobootprompt", nobootprompt(localroot));
inienv("cputype", "386");