ostree-prepare-root as init: exec init from deployment if run as PID1
This supports running ostree on embedded platforms without an initrd. Specificially I'm trying to do bringup on an NVidia Tegra based Jetson TK1 dev board. Closes: #403 Approved by: cgwalters
This commit is contained in:
parent
1364e6e30d
commit
c9551dc231
|
|
@ -156,12 +156,10 @@ main(int argc, char *argv[])
|
|||
int orig_cwd_dfd;
|
||||
|
||||
if (argc < 2)
|
||||
{
|
||||
fprintf (stderr, "usage: ostree-prepare-root SYSROOT\n");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
root_mountpoint = "/";
|
||||
else
|
||||
root_mountpoint = argv[1];
|
||||
|
||||
deploy_path = resolve_deploy_path (root_mountpoint);
|
||||
|
||||
/* Create a temporary target for our mounts in the initramfs; this will
|
||||
|
|
@ -304,5 +302,14 @@ main(int argc, char *argv[])
|
|||
exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (getpid() == 1)
|
||||
{
|
||||
execl ("/sbin/init", "/sbin/init", NULL);
|
||||
perrorv ("failed to exec init inside ostree");
|
||||
exit (EXIT_FAILURE);
|
||||
}
|
||||
else
|
||||
{
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue