summaryrefslogtreecommitdiffstats
path: root/usr.sbin/sysinstall
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r--usr.sbin/sysinstall/Makefile2
-rw-r--r--usr.sbin/sysinstall/cdrom.c35
-rw-r--r--usr.sbin/sysinstall/dist.c15
-rw-r--r--usr.sbin/sysinstall/sysinstall.h17
4 files changed, 34 insertions, 35 deletions
diff --git a/usr.sbin/sysinstall/Makefile b/usr.sbin/sysinstall/Makefile
index db2a2cb..a252c16 100644
--- a/usr.sbin/sysinstall/Makefile
+++ b/usr.sbin/sysinstall/Makefile
@@ -9,7 +9,7 @@ CLEANFILES+= keymap.tmp keymap.h
.PATH: ${.CURDIR}/../disklabel ${.CURDIR}/../../usr.bin/cksum
-SRCS= anonFTP.c attr.c cdrom.c command.c config.c devices.c \
+SRCS= anonFTP.c cdrom.c command.c config.c devices.c \
disks.c dispatch.c dist.c dmenu.c doc.c dos.c floppy.c \
ftp.c globals.c index.c install.c installUpgrade.c keymap.c \
label.c lndir.c main.c makedevs.c media.c menus.c misc.c mouse.c \
diff --git a/usr.sbin/sysinstall/cdrom.c b/usr.sbin/sysinstall/cdrom.c
index 460d815..1fd1380 100644
--- a/usr.sbin/sysinstall/cdrom.c
+++ b/usr.sbin/sysinstall/cdrom.c
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: cdrom.c,v 1.41 1998/07/21 06:44:38 jkh Exp $
+ * $Id: cdrom.c,v 1.42 1998/08/27 00:50:14 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -46,6 +46,7 @@
#include <unistd.h>
#include <grp.h>
#include <fcntl.h>
+#include <libutil.h>
#define CD9660
#include <sys/mount.h>
@@ -54,27 +55,37 @@
static Boolean cdromMounted;
+static properties
+read_props(char *name)
+{
+ int fd;
+ properties n;
+
+ fd = open(name, O_RDONLY);
+ if (fd == -1)
+ return NULL;
+ n = properties_read(fd);
+ close(fd);
+ return n;
+}
+
Boolean
mediaInitCDROM(Device *dev)
{
struct iso_args args;
- Attribs *cd_attr;
- char *cp, *mountpoint = "/dist";
+ properties cd_attr = NULL;
+ char *cp = NULL, *mountpoint = "/dist";
Boolean readInfo = TRUE;
static Boolean bogusCDOK = FALSE;
if (cdromMounted)
return TRUE;
+ Mkdir(mountpoint);
+
bzero(&args, sizeof(args));
args.fspec = dev->devname;
args.flags = 0;
-
- cd_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
- cp = NULL;
-
- Mkdir(mountpoint);
-
if (mount("cd9660", mountpoint, MNT_RDONLY, (caddr_t) &args) == -1) {
if (errno == EINVAL) {
msgConfirm("The CD in your drive looks more like an Audio CD than a FreeBSD release.");
@@ -104,8 +115,8 @@ mediaInitCDROM(Device *dev)
}
if (readInfo &&
- (DITEM_STATUS(attr_parse_file(cd_attr, string_concat(mountpoint, "/cdrom.inf"))) == DITEM_FAILURE ||
- !(cp = attr_match(cd_attr, "CD_VERSION")) || (strcmp(cp, variable_get(VAR_RELNAME)) && strcmp("none", variable_get(VAR_RELNAME))))) {
+ (!(cd_attr = read_props(string_concat(mountpoint, "/cdrom.inf"))) ||
+ !(cp = property_find(cd_attr, "CD_VERSION")) || (strcmp(cp, variable_get(VAR_RELNAME)) && strcmp("none", variable_get(VAR_RELNAME))))) {
if (!cp) {
msgConfirm("Unable to find a %s/cdrom.inf file.\n"
"Either this is not a FreeBSD CDROM, there is a problem with\n"
@@ -125,6 +136,7 @@ mediaInitCDROM(Device *dev)
if (msgYesNo("Would you like to try and use this CDROM anyway?") != 0) {
unmount(mountpoint, MNT_FORCE);
cdromMounted = FALSE;
+ properties_free(cd_attr);
return FALSE;
}
else
@@ -132,6 +144,7 @@ mediaInitCDROM(Device *dev)
}
}
msgDebug("Mounted FreeBSD CDROM from device %s\n", dev->devname);
+ properties_free(cd_attr);
return TRUE;
}
diff --git a/usr.sbin/sysinstall/dist.c b/usr.sbin/sysinstall/dist.c
index b11ed60..ad2ae0c 100644
--- a/usr.sbin/sysinstall/dist.c
+++ b/usr.sbin/sysinstall/dist.c
@@ -4,7 +4,7 @@
* This is probably the last program in the `sysinstall' line - the next
* generation being essentially a complete rewrite.
*
- * $Id: dist.c,v 1.126 1998/09/23 12:13:47 jkh Exp $
+ * $Id: dist.c,v 1.127 1998/09/29 07:27:33 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -37,6 +37,7 @@
#include "sysinstall.h"
#include <sys/time.h>
#include <signal.h>
+#include <libutil.h>
unsigned int Dists;
unsigned int DESDists;
@@ -558,25 +559,25 @@ distExtract(char *parent, Distribution *me)
}
}
else if (fp > 0) {
- int status;
- Attribs *dist_attr;
+ properties dist_attr;
if (isDebug())
msgDebug("Parsing attributes file for distribution %s\n", dist);
- dist_attr = alloca(sizeof(Attribs) * MAX_ATTRIBS);
- status = attr_parse(dist_attr, fp);
+ dist_attr = properties_read(fileno(fp));
intr = check_for_interrupt();
- if (intr || DITEM_STATUS(status) == DITEM_FAILURE)
+ if (intr || !dist_attr) {
msgConfirm("Cannot parse information file for the %s distribution: %s\n"
"Please verify that your media is valid and try again.",
dist, !intr ? "I/O error" : "User interrupt");
+ }
else {
- tmp = attr_match(dist_attr, "pieces");
+ tmp = property_find(dist_attr, "pieces");
if (tmp)
numchunks = strtol(tmp, 0, 0);
}
fclose(fp);
+ properties_free(dist_attr);
if (!numchunks)
continue;
}
diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h
index e08843b..c74c423 100644
--- a/usr.sbin/sysinstall/sysinstall.h
+++ b/usr.sbin/sysinstall/sysinstall.h
@@ -4,7 +4,7 @@
* This is probably the last attempt in the `sysinstall' line, the next
* generation being slated to essentially a complete rewrite.
*
- * $Id: sysinstall.h,v 1.147 1998/07/18 09:42:01 jkh Exp $
+ * $Id: sysinstall.h,v 1.148 1998/09/30 11:49:37 jkh Exp $
*
* Copyright (c) 1995
* Jordan Hubbard. All rights reserved.
@@ -223,16 +223,6 @@ typedef struct _layout {
void *obj; /* The obj pointer returned by libdialog */
} Layout;
-/* For attribs */
-#define MAX_ATTRIBS 200
-#define MAX_NAME 64
-#define MAX_VALUE 256
-
-typedef struct _attribs {
- char name[MAX_NAME];
- char value[MAX_VALUE];
-} Attribs;
-
typedef enum {
DEVICE_TYPE_NONE,
DEVICE_TYPE_DISK,
@@ -404,11 +394,6 @@ extern void display_helpline(WINDOW *w, int y, int width);
/* anonFTP.c */
extern int configAnonFTP(dialogMenuItem *self);
-/* attrs.c */
-extern char *attr_match(Attribs *attr, char *name);
-extern int attr_parse_file(Attribs *attr, char *file);
-extern int attr_parse(Attribs *attr, FILE *fp);
-
/* cdrom.c */
extern Boolean mediaInitCDROM(Device *dev);
extern FILE *mediaGetCDROM(Device *dev, char *file, Boolean probe);
OpenPOWER on IntegriCloud