Пример #1
0
JS_EXPORT_API
gboolean installer_chroot_target ()
{
    gboolean ret = FALSE;
    if (!mount_procfs ()) {
        goto out;
    }

    extern const gchar* target;
    if (target == NULL) {
        g_warning ("chroot:target is NULL\n");
        goto out;
    }
    extern int chroot_fd;
    if ((chroot_fd = open (".", O_RDONLY)) < 0) {
        g_warning ("chroot:set chroot fd failed\n");
        goto out;
    }

    extern gboolean in_chroot;
    if (chroot (target) == 0) {
        in_chroot = TRUE;
        ret = TRUE;
    } else {
        g_warning ("chroot:chroot to %s falied:%s\n", target, strerror (errno));
    }
    goto out;

out:
    if (ret) {
        emit_progress ("chroot", "finish");
    } else {
        emit_progress ("chroot", "terminate");
    }
    return ret;
}
Пример #2
0
int
main(int argc, char **argv)
{
	return mount_procfs(argc, argv);
}