Make CDROMs automagically select as the default media type.
If you're running multi-user, check off items in the packages menu based on whether or not they're actually installed.
This commit is contained in:
parent
43ebe040fe
commit
7b0a4c23a4
@ -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.12 1996/04/13 13:31:23 jkh Exp $
|
||||
* $Id: cdrom.c,v 1.13 1996/04/23 01:29:10 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -51,6 +51,10 @@
|
||||
#include <sys/mount.h>
|
||||
#undef CD9660
|
||||
|
||||
#define CD_UNMOUNTED 0
|
||||
#define CD_ALREADY_MOUNTED 1
|
||||
#define CD_WE_MOUNTED_IT 2
|
||||
|
||||
/*
|
||||
* This isn't static, like the others, since it's often useful to know whether
|
||||
* or not we have a CDROM available in some of the other installation screens.
|
||||
@ -65,10 +69,8 @@ Boolean
|
||||
mediaInitCDROM(Device *dev)
|
||||
{
|
||||
struct iso_args args;
|
||||
struct stat sb;
|
||||
char specialrel[80];
|
||||
|
||||
if (!RunningAsInit || cdromMounted)
|
||||
if (cdromMounted != CD_UNMOUNTED)
|
||||
return TRUE;
|
||||
|
||||
if (Mkdir("/cdrom", NULL))
|
||||
@ -78,31 +80,17 @@ mediaInitCDROM(Device *dev)
|
||||
args.fspec = dev->devname;
|
||||
args.flags = 0;
|
||||
|
||||
if (directory_exists("/cdrom/dists"))
|
||||
cdromMounted = 2;
|
||||
else if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
|
||||
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
|
||||
return FALSE;
|
||||
}
|
||||
/*
|
||||
* Do a very simple check to see if this looks roughly like a FreeBSD CDROM
|
||||
* Unfortunately FreeBSD won't let us read the ``label'' AFAIK, which is one
|
||||
* sure way of telling the disc version :-(
|
||||
*/
|
||||
snprintf(specialrel, 80, "/cdrom/%s/dists", variable_get(VAR_RELNAME));
|
||||
if (stat("/cdrom/dists", &sb) && stat(specialrel, &sb)) {
|
||||
if (errno == ENOENT) {
|
||||
msgConfirm("Couldn't locate the directory `dists' anywhere on the CD.\n"
|
||||
"Is this a FreeBSD CDROM? Is the release version set properly\n"
|
||||
"in the Options editor?");
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
msgConfirm("Error trying to stat the CDROM's dists directory: %s", strerror(errno));
|
||||
/* If this cdrom's not already mounted or can't be mounted, yell */
|
||||
if (!directory_exists("/cdrom/dists")) {
|
||||
if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
|
||||
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
cdromMounted = CD_WE_MOUNTED_IT;
|
||||
}
|
||||
cdromMounted = 1;
|
||||
else
|
||||
cdromMounted = CD_ALREADY_MOUNTED;
|
||||
msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname);
|
||||
return TRUE;
|
||||
}
|
||||
@ -129,12 +117,16 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe)
|
||||
void
|
||||
mediaShutdownCDROM(Device *dev)
|
||||
{
|
||||
if (!RunningAsInit || !cdromMounted || cdromMounted == 2)
|
||||
/* Only undo it if we did it */
|
||||
if (cdromMounted != CD_WE_MOUNTED_IT)
|
||||
return;
|
||||
msgDebug("Unmounting %s from /cdrom\n", dev->devname);
|
||||
if (unmount("/cdrom", MNT_FORCE) != 0)
|
||||
if (unmount("/cdrom", MNT_FORCE) != 0) {
|
||||
msgConfirm("Could not unmount the CDROM from /cdrom: %s", strerror(errno));
|
||||
msgDebug("Unmount successful\n");
|
||||
cdromMounted = 0;
|
||||
return;
|
||||
cdromMounted = CD_ALREADY_MOUNTED; /* Guess somebody else got it */
|
||||
}
|
||||
else {
|
||||
msgDebug("Unmount successful\n");
|
||||
cdromMounted = CD_UNMOUNTED;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: config.c,v 1.32 1996/05/23 16:34:24 jkh Exp $
|
||||
* $Id: config.c,v 1.33 1996/05/29 01:35:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -473,6 +473,7 @@ configPackages(dialogMenuItem *self)
|
||||
}
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("No packages were selected for extraction.");
|
||||
break;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: index.c,v 1.29 1996/05/16 11:47:29 jkh Exp $
|
||||
* $Id: index.c,v 1.30 1996/05/23 16:34:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -384,8 +384,15 @@ pkg_checked(dialogMenuItem *self)
|
||||
{
|
||||
PkgNodePtr kp = self->data, plist = (PkgNodePtr)self->aux;
|
||||
|
||||
if (kp->type == PACKAGE && plist)
|
||||
return index_search(plist, kp->name, NULL) ? TRUE : FALSE;
|
||||
if (kp->type == PACKAGE && kp->name && plist) {
|
||||
int i;
|
||||
|
||||
i = index_search(plist, kp->name, NULL) ? TRUE : FALSE;
|
||||
if (!RunningAsInit)
|
||||
return i || package_exists(kp->name);
|
||||
else
|
||||
return i;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
@ -402,14 +409,16 @@ pkg_fire(dialogMenuItem *self)
|
||||
sp = index_search(plist, kp->name, NULL);
|
||||
/* Not already selected? */
|
||||
if (!sp) {
|
||||
PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
if (RunningAsInit || !package_exists(kp->name)) {
|
||||
PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
|
||||
*np = *kp;
|
||||
np->next = plist->kids;
|
||||
plist->kids = np;
|
||||
msgInfo("Added %s to selection list", kp->name);
|
||||
*np = *kp;
|
||||
np->next = plist->kids;
|
||||
plist->kids = np;
|
||||
msgInfo("Added %s to selection list", kp->name);
|
||||
}
|
||||
}
|
||||
else if (sp) {
|
||||
else {
|
||||
msgInfo("Removed %s from selection list", kp->name);
|
||||
index_delete(sp);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.19 1996/05/16 11:47:33 jkh Exp $
|
||||
* $Id: main.c,v 1.20 1996/05/28 18:30:30 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -83,6 +83,12 @@ main(int argc, char **argv)
|
||||
/* Probe for all relevant devices on the system */
|
||||
deviceGetAll();
|
||||
|
||||
/* Try to set ourselves up as a CDROM if we can do that first */
|
||||
if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) {
|
||||
/* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */
|
||||
if (!mediaDevice->init(mediaDevice))
|
||||
mediaDevice = NULL;
|
||||
}
|
||||
if (argc > 1 && !RunningAsInit) {
|
||||
int i;
|
||||
|
||||
|
@ -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: media.c,v 1.37 1996/04/28 01:07:24 jkh Exp $
|
||||
* $Id: media.c,v 1.38 1996/04/28 03:27:11 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -85,10 +85,11 @@ mediaSetCDROM(dialogMenuItem *self)
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
|
||||
cnt = deviceCount(devs);
|
||||
if (!cnt) {
|
||||
msgConfirm("No CDROM devices found! Please check that your system's\n"
|
||||
"configuration is correct and that the CDROM drive is of a supported\n"
|
||||
"type. For more information, consult the hardware guide\n"
|
||||
"in the Doc menu.");
|
||||
if (self) /* Interactive? */
|
||||
msgConfirm("No CDROM devices found! Please check that your system's\n"
|
||||
"configuration is correct and that the CDROM drive is of a supported\n"
|
||||
"type. For more information, consult the hardware guide\n"
|
||||
"in the Doc menu.");
|
||||
return DITEM_FAILURE | DITEM_CONTINUE;
|
||||
}
|
||||
else if (cnt > 1) {
|
||||
@ -105,7 +106,7 @@ mediaSetCDROM(dialogMenuItem *self)
|
||||
}
|
||||
else
|
||||
mediaDevice = devs[0];
|
||||
return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE | DITEM_RECREATE;
|
||||
return (mediaDevice ? DITEM_SUCCESS | DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE | DITEM_RECREATE;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: config.c,v 1.32 1996/05/23 16:34:24 jkh Exp $
|
||||
* $Id: config.c,v 1.33 1996/05/29 01:35:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -473,6 +473,7 @@ configPackages(dialogMenuItem *self)
|
||||
}
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("No packages were selected for extraction.");
|
||||
break;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.19 1996/05/16 11:47:33 jkh Exp $
|
||||
* $Id: main.c,v 1.20 1996/05/28 18:30:30 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -83,6 +83,12 @@ main(int argc, char **argv)
|
||||
/* Probe for all relevant devices on the system */
|
||||
deviceGetAll();
|
||||
|
||||
/* Try to set ourselves up as a CDROM if we can do that first */
|
||||
if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) {
|
||||
/* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */
|
||||
if (!mediaDevice->init(mediaDevice))
|
||||
mediaDevice = NULL;
|
||||
}
|
||||
if (argc > 1 && !RunningAsInit) {
|
||||
int i;
|
||||
|
||||
|
@ -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.12 1996/04/13 13:31:23 jkh Exp $
|
||||
* $Id: cdrom.c,v 1.13 1996/04/23 01:29:10 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -51,6 +51,10 @@
|
||||
#include <sys/mount.h>
|
||||
#undef CD9660
|
||||
|
||||
#define CD_UNMOUNTED 0
|
||||
#define CD_ALREADY_MOUNTED 1
|
||||
#define CD_WE_MOUNTED_IT 2
|
||||
|
||||
/*
|
||||
* This isn't static, like the others, since it's often useful to know whether
|
||||
* or not we have a CDROM available in some of the other installation screens.
|
||||
@ -65,10 +69,8 @@ Boolean
|
||||
mediaInitCDROM(Device *dev)
|
||||
{
|
||||
struct iso_args args;
|
||||
struct stat sb;
|
||||
char specialrel[80];
|
||||
|
||||
if (!RunningAsInit || cdromMounted)
|
||||
if (cdromMounted != CD_UNMOUNTED)
|
||||
return TRUE;
|
||||
|
||||
if (Mkdir("/cdrom", NULL))
|
||||
@ -78,31 +80,17 @@ mediaInitCDROM(Device *dev)
|
||||
args.fspec = dev->devname;
|
||||
args.flags = 0;
|
||||
|
||||
if (directory_exists("/cdrom/dists"))
|
||||
cdromMounted = 2;
|
||||
else if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
|
||||
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
|
||||
return FALSE;
|
||||
}
|
||||
/*
|
||||
* Do a very simple check to see if this looks roughly like a FreeBSD CDROM
|
||||
* Unfortunately FreeBSD won't let us read the ``label'' AFAIK, which is one
|
||||
* sure way of telling the disc version :-(
|
||||
*/
|
||||
snprintf(specialrel, 80, "/cdrom/%s/dists", variable_get(VAR_RELNAME));
|
||||
if (stat("/cdrom/dists", &sb) && stat(specialrel, &sb)) {
|
||||
if (errno == ENOENT) {
|
||||
msgConfirm("Couldn't locate the directory `dists' anywhere on the CD.\n"
|
||||
"Is this a FreeBSD CDROM? Is the release version set properly\n"
|
||||
"in the Options editor?");
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
msgConfirm("Error trying to stat the CDROM's dists directory: %s", strerror(errno));
|
||||
/* If this cdrom's not already mounted or can't be mounted, yell */
|
||||
if (!directory_exists("/cdrom/dists")) {
|
||||
if (mount(MOUNT_CD9660, "/cdrom", MNT_RDONLY, (caddr_t) &args) == -1) {
|
||||
msgConfirm("Error mounting %s on /cdrom: %s (%u)", dev->devname, strerror(errno), errno);
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
cdromMounted = CD_WE_MOUNTED_IT;
|
||||
}
|
||||
cdromMounted = 1;
|
||||
else
|
||||
cdromMounted = CD_ALREADY_MOUNTED;
|
||||
msgDebug("Mounted CDROM device %s on /cdrom\n", dev->devname);
|
||||
return TRUE;
|
||||
}
|
||||
@ -129,12 +117,16 @@ mediaGetCDROM(Device *dev, char *file, Boolean probe)
|
||||
void
|
||||
mediaShutdownCDROM(Device *dev)
|
||||
{
|
||||
if (!RunningAsInit || !cdromMounted || cdromMounted == 2)
|
||||
/* Only undo it if we did it */
|
||||
if (cdromMounted != CD_WE_MOUNTED_IT)
|
||||
return;
|
||||
msgDebug("Unmounting %s from /cdrom\n", dev->devname);
|
||||
if (unmount("/cdrom", MNT_FORCE) != 0)
|
||||
if (unmount("/cdrom", MNT_FORCE) != 0) {
|
||||
msgConfirm("Could not unmount the CDROM from /cdrom: %s", strerror(errno));
|
||||
msgDebug("Unmount successful\n");
|
||||
cdromMounted = 0;
|
||||
return;
|
||||
cdromMounted = CD_ALREADY_MOUNTED; /* Guess somebody else got it */
|
||||
}
|
||||
else {
|
||||
msgDebug("Unmount successful\n");
|
||||
cdromMounted = CD_UNMOUNTED;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: config.c,v 1.32 1996/05/23 16:34:24 jkh Exp $
|
||||
* $Id: config.c,v 1.33 1996/05/29 01:35:25 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -473,6 +473,7 @@ configPackages(dialogMenuItem *self)
|
||||
}
|
||||
}
|
||||
else {
|
||||
dialog_clear();
|
||||
msgConfirm("No packages were selected for extraction.");
|
||||
break;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: index.c,v 1.29 1996/05/16 11:47:29 jkh Exp $
|
||||
* $Id: index.c,v 1.30 1996/05/23 16:34:27 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -384,8 +384,15 @@ pkg_checked(dialogMenuItem *self)
|
||||
{
|
||||
PkgNodePtr kp = self->data, plist = (PkgNodePtr)self->aux;
|
||||
|
||||
if (kp->type == PACKAGE && plist)
|
||||
return index_search(plist, kp->name, NULL) ? TRUE : FALSE;
|
||||
if (kp->type == PACKAGE && kp->name && plist) {
|
||||
int i;
|
||||
|
||||
i = index_search(plist, kp->name, NULL) ? TRUE : FALSE;
|
||||
if (!RunningAsInit)
|
||||
return i || package_exists(kp->name);
|
||||
else
|
||||
return i;
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
}
|
||||
@ -402,14 +409,16 @@ pkg_fire(dialogMenuItem *self)
|
||||
sp = index_search(plist, kp->name, NULL);
|
||||
/* Not already selected? */
|
||||
if (!sp) {
|
||||
PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
if (RunningAsInit || !package_exists(kp->name)) {
|
||||
PkgNodePtr np = (PkgNodePtr)safe_malloc(sizeof(PkgNode));
|
||||
|
||||
*np = *kp;
|
||||
np->next = plist->kids;
|
||||
plist->kids = np;
|
||||
msgInfo("Added %s to selection list", kp->name);
|
||||
*np = *kp;
|
||||
np->next = plist->kids;
|
||||
plist->kids = np;
|
||||
msgInfo("Added %s to selection list", kp->name);
|
||||
}
|
||||
}
|
||||
else if (sp) {
|
||||
else {
|
||||
msgInfo("Removed %s from selection list", kp->name);
|
||||
index_delete(sp);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
* This is probably the last attempt in the `sysinstall' line, the next
|
||||
* generation being slated for what's essentially a complete rewrite.
|
||||
*
|
||||
* $Id: main.c,v 1.19 1996/05/16 11:47:33 jkh Exp $
|
||||
* $Id: main.c,v 1.20 1996/05/28 18:30:30 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -83,6 +83,12 @@ main(int argc, char **argv)
|
||||
/* Probe for all relevant devices on the system */
|
||||
deviceGetAll();
|
||||
|
||||
/* Try to set ourselves up as a CDROM if we can do that first */
|
||||
if (DITEM_STATUS(mediaSetCDROM(NULL)) == DITEM_SUCCESS) {
|
||||
/* If we can't initialize it, it's probably not a FreeBSD CDROM so punt on it */
|
||||
if (!mediaDevice->init(mediaDevice))
|
||||
mediaDevice = NULL;
|
||||
}
|
||||
if (argc > 1 && !RunningAsInit) {
|
||||
int i;
|
||||
|
||||
|
@ -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: media.c,v 1.37 1996/04/28 01:07:24 jkh Exp $
|
||||
* $Id: media.c,v 1.38 1996/04/28 03:27:11 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
@ -85,10 +85,11 @@ mediaSetCDROM(dialogMenuItem *self)
|
||||
devs = deviceFind(NULL, DEVICE_TYPE_CDROM);
|
||||
cnt = deviceCount(devs);
|
||||
if (!cnt) {
|
||||
msgConfirm("No CDROM devices found! Please check that your system's\n"
|
||||
"configuration is correct and that the CDROM drive is of a supported\n"
|
||||
"type. For more information, consult the hardware guide\n"
|
||||
"in the Doc menu.");
|
||||
if (self) /* Interactive? */
|
||||
msgConfirm("No CDROM devices found! Please check that your system's\n"
|
||||
"configuration is correct and that the CDROM drive is of a supported\n"
|
||||
"type. For more information, consult the hardware guide\n"
|
||||
"in the Doc menu.");
|
||||
return DITEM_FAILURE | DITEM_CONTINUE;
|
||||
}
|
||||
else if (cnt > 1) {
|
||||
@ -105,7 +106,7 @@ mediaSetCDROM(dialogMenuItem *self)
|
||||
}
|
||||
else
|
||||
mediaDevice = devs[0];
|
||||
return (mediaDevice ? DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE | DITEM_RECREATE;
|
||||
return (mediaDevice ? DITEM_SUCCESS | DITEM_LEAVE_MENU : DITEM_FAILURE) | DITEM_RESTORE | DITEM_RECREATE;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
x
Reference in New Issue
Block a user