-PROG= newroot
+SCRIPTS= newroot.sh
MAN=
.include <bsd.prog.mk>
+++ /dev/null
-/*
-newroot.c
-
-Replace the current root with a new one
-*/
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/mount.h>
-
-void usage(void) {
- fprintf(stderr, "Usage: newroot [-i] <block-special>\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;
-}
--- /dev/null
+#!/bin/sh
+
+# Actually, newroot is just like mounting on the root
+exec mount "$*" /
+
# 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
../../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/$@/$@ $@
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