Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e7cb137f authored by Jay Freeman (saurik)'s avatar Jay Freeman (saurik) Committed by Jean-Baptiste Queru
Browse files

added chdir/chroot commands to init for mount switching/pivoting

parent 9f28bde9
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -131,6 +131,18 @@ static void service_start_if_not_disabled(struct service *svc)
    }
}

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
+4 −0
Original line number Diff line number Diff line

#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 @@ enum {
    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)
+2 −0
Original line number Diff line number Diff line
@@ -128,6 +128,8 @@ int lookup_keyword(const char *s)
    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;
+6 −0
Original line number Diff line number Diff line
@@ -145,12 +145,18 @@ import <filename>
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.