added chdir/chroot commands to init for mount switching/pivoting
diff --git a/init/builtins.c b/init/builtins.c
index 289f0cd..43508ef 100644
--- a/init/builtins.c
+++ b/init/builtins.c
@@ -131,6 +131,18 @@
}
}
+int do_chdir(int nargs, char **args)
+{
+ chdir(args[1]);
+ return 0;
+}
+
+int do_chroot(int nargs, char **args)
+{
+ chroot(args[1]);
+ return 0;
+}
+
int do_class_start(int nargs, char **args)
{
/* Starting a class does not start services
diff --git a/init/keywords.h b/init/keywords.h
index 6f47379..1e2b9c8 100644
--- a/init/keywords.h
+++ b/init/keywords.h
@@ -1,5 +1,7 @@
#ifndef KEYWORD
+int do_chroot(int nargs, char **args);
+int do_chdir(int nargs, char **args);
int do_class_start(int nargs, char **args);
int do_class_stop(int nargs, char **args);
int do_domainname(int nargs, char **args);
@@ -31,6 +33,8 @@
K_UNKNOWN,
#endif
KEYWORD(capability, OPTION, 0, 0)
+ KEYWORD(chdir, COMMAND, 1, do_chdir)
+ KEYWORD(chroot, COMMAND, 1, do_chroot)
KEYWORD(class, OPTION, 0, 0)
KEYWORD(class_start, COMMAND, 1, do_class_start)
KEYWORD(class_stop, COMMAND, 1, do_class_stop)
diff --git a/init/parser.c b/init/parser.c
index 33c1a68..0eb078d 100644
--- a/init/parser.c
+++ b/init/parser.c
@@ -128,6 +128,8 @@
switch (*s++) {
case 'c':
if (!strcmp(s, "apability")) return K_capability;
+ if (!strcmp(s, "hdir")) return K_chdir;
+ if (!strcmp(s, "hroot")) return K_chroot;
if (!strcmp(s, "lass")) return K_class;
if (!strcmp(s, "lass_start")) return K_class_start;
if (!strcmp(s, "lass_stop")) return K_class_stop;
diff --git a/init/readme.txt b/init/readme.txt
index 665090b..a185790 100644
--- a/init/readme.txt
+++ b/init/readme.txt
@@ -145,12 +145,18 @@
hostname <name>
Set the host name.
+chdir <directory>
+ Change working directory.
+
chmod <octal-mode> <path>
Change file access permissions.
chown <owner> <group> <path>
Change file owner and group.
+chroot <directory>
+ Change process root directory.
+
class_start <serviceclass>
Start all services of the specified class if they are
not already running.