diff --git a/commands/newroot/Makefile b/commands/newroot/Makefile index db80764d0..d23bb9dc2 100644 --- a/commands/newroot/Makefile +++ b/commands/newroot/Makefile @@ -1,4 +1,4 @@ -PROG= newroot +SCRIPTS= newroot.sh MAN= .include diff --git a/commands/newroot/newroot.c b/commands/newroot/newroot.c deleted file mode 100644 index e6ea8cc27..000000000 --- a/commands/newroot/newroot.c +++ /dev/null @@ -1,45 +0,0 @@ -/* -newroot.c - -Replace the current root with a new one -*/ - -#include -#include -#include -#include -#include - -void usage(void) { - fprintf(stderr, "Usage: newroot [-i] \n"); - fprintf(stderr, "-i: copy mfs binary from boot image to memory\n"); - exit(1); -} - -int main(int argc, char *argv[]) -{ - int r; - char *dev; - int mountflags; - - r = 0; - mountflags = 0; /* !read-only */ - - if (argc != 2 && argc != 3) usage(); - if(argc == 2) { - dev = argv[1]; - } else if(argc == 3) { - /* -i flag was supposedly entered. Verify.*/ - if(strcmp(argv[1], "-i") != 0) usage(); - mountflags |= MS_REUSE; - dev = argv[2]; - } - - r = mount(dev, "/", mountflags, NULL, NULL); - if (r != 0) { - fprintf(stderr, "newroot: mount failed: %s\n",strerror(errno)); - exit(1); - } - - return 0; -} diff --git a/commands/newroot/newroot.sh b/commands/newroot/newroot.sh new file mode 100644 index 000000000..0689fc323 --- /dev/null +++ b/commands/newroot/newroot.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +# Actually, newroot is just like mounting on the root +exec mount "$*" / + diff --git a/drivers/ramdisk/Makefile b/drivers/ramdisk/Makefile index f8728f30b..197faf5ea 100644 --- a/drivers/ramdisk/Makefile +++ b/drivers/ramdisk/Makefile @@ -1,6 +1,6 @@ # Makefile for ramdisk image -PROGRAMS=at_wini bios_wini cdprobe dev2name floppy loadramdisk newroot \ +PROGRAMS=at_wini bios_wini cdprobe dev2name floppy loadramdisk mount newroot \ pci sh service sysenv mfs EXTRA=system.conf passwd rs.single @@ -67,6 +67,12 @@ loadramdisk: ../../commands/loadramdisk/loadramdisk ../../commands/loadramdisk/loadramdisk: $(MAKE) -C ../../commands/loadramdisk +mount: ../../commands/mount/mount + install -s ../../commands/$@/$@ $@ + +../../commands/mount/mount: + $(MAKE) -C ../../commands/mount + newroot: ../../commands/newroot/newroot install -s ../../commands/$@/$@ $@ diff --git a/drivers/ramdisk/proto b/drivers/ramdisk/proto index 48d802286..cef0f0c68 100644 --- a/drivers/ramdisk/proto +++ b/drivers/ramdisk/proto @@ -5,6 +5,7 @@ d--755 0 0 cdprobe ---755 0 0 cdprobe dev2name ---755 0 0 dev2name loadramdisk ---755 0 0 loadramdisk + mount ---755 0 0 mount newroot ---755 0 0 newroot sh ---755 0 0 sh service ---755 0 0 service