summaryrefslogtreecommitdiffstats
path: root/release/sysinstall/misc.c
diff options
context:
space:
mode:
authorjkh <jkh@FreeBSD.org>1995-05-16 11:37:27 +0000
committerjkh <jkh@FreeBSD.org>1995-05-16 11:37:27 +0000
commit56016c7548b0eaa3e7190993e87b7b8d0a0bd02c (patch)
treeb37ec9f9cf4478f56803d142759b8dc671accdd9 /release/sysinstall/misc.c
parent3f349e7ec85ac3affae816bfa10292b655d4eb44 (diff)
downloadFreeBSD-src-56016c7548b0eaa3e7190993e87b7b8d0a0bd02c.zip
FreeBSD-src-56016c7548b0eaa3e7190993e87b7b8d0a0bd02c.tar.gz
This will now compile and even scribble helpfully on your disks.
It remains to be seen how successfully. The distribution loading code is still not here yet, but the partition/newfs/mount/cpio-extract cycle is as complete as it's ever going to get, modulo possible bug fixes. The TCP/IP setup screen is also sort of here, albeit in a highly-changing state due to the fact that per-interface information isn't being kept right now but is being added (thanks, Gary!).
Diffstat (limited to 'release/sysinstall/misc.c')
-rw-r--r--release/sysinstall/misc.c71
1 files changed, 70 insertions, 1 deletions
diff --git a/release/sysinstall/misc.c b/release/sysinstall/misc.c
index 500b454..5084c88 100644
--- a/release/sysinstall/misc.c
+++ b/release/sysinstall/misc.c
@@ -1,7 +1,7 @@
/*
* Miscellaneous support routines..
*
- * $Id: misc.c,v 1.3 1995/05/01 21:56:27 jkh Exp $
+ * $Id: misc.c,v 1.4 1995/05/08 21:39:39 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -40,6 +40,16 @@
#include "sysinstall.h"
#include <ctype.h>
+#include <sys/stat.h>
+#include <sys/errno.h>
+#include <sys/file.h>
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <sys/param.h>
+#include <sys/mount.h>
+#include <sys/reboot.h>
+#include <sys/dkbad.h>
+#include <sys/disklabel.h>
/* Quick check to see if a file is readable */
Boolean
@@ -161,3 +171,62 @@ items_free(char **list, int *curr, int *max)
*curr = *max = 0;
}
+int
+Mkdir(char *ipath, void *data)
+{
+ struct stat sb;
+ int final=0;
+ char *p, *path = strdup(ipath);
+
+ msgDebug("mkdir(%s)\n", path);
+ p = path;
+ if (p[0] == '/') /* Skip leading '/'. */
+ ++p;
+ for (;!final; ++p) {
+ if (p[0] == '\0' || (p[0] == '/' && p[1] == '\0'))
+ final++;
+ else if (p[0] != '/')
+ continue;
+ *p = '\0';
+ if (stat(path, &sb)) {
+ if (errno != ENOENT) {
+ msgConfirm("Couldn't stat directory %s: %s", path, strerror(errno));
+ return 1;
+ }
+ msgDebug("mkdir(%s..)\n", path);
+ if (mkdir(path, S_IRWXU | S_IRWXG | S_IRWXO) < 0) {
+ msgConfirm("Couldn't create directory %s: %s", path,strerror(errno));
+ return 1;
+ }
+ }
+ *p = '/';
+ }
+ free(path);
+ return 0;
+}
+
+int
+Mount(char *device, void *data)
+{
+ struct ufs_args ufsargs;
+ char mountpoint[FILENAME_MAX];
+
+ strcpy(mountpoint, "/mnt");
+ if (data)
+ sprintf(mountpoint + 4, "/%s", (char *)data);
+
+ memset(&ufsargs,0,sizeof ufsargs);
+
+ if (access(mountpoint, R_OK))
+ Mkdir(mountpoint, NULL);
+
+ msgDebug("mount %s %s\n", device, mountpoint);
+ ufsargs.fspec = device;
+ if (mount(MOUNT_UFS, mountpoint, 0, (caddr_t)&ufsargs) == -1) {
+ msgConfirm("Error mounting %s on %s : %s\n",
+ device, mountpoint, strerror(errno));
+ return 1;
+ }
+ return 0;
+}
+
OpenPOWER on IntegriCloud