mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 01:30:30 -04:00
Add an option for resetting and rescanning the probed device list, perhaps
to now detect that CD you just remembered to put in the drive or that pccard NIC that you've inserted (anybody can put pccardd in an mfsroot image now you know.. :) Requested by: Annelise Anderson <andrsn@andrsn.Stanford.EDU>
This commit is contained in:
parent
47b9dbd431
commit
3e6a56bb87
10 changed files with 109 additions and 14 deletions
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: devices.c,v 1.87 1998/12/04 18:01:10 wpaul Exp $
|
||||
* $Id: devices.c,v 1.88 1999/01/09 18:12:06 wpaul Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -202,6 +202,25 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e
|
|||
return newdev;
|
||||
}
|
||||
|
||||
/* Reset the registered device chain */
|
||||
void
|
||||
deviceReset(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numDevs; i++) {
|
||||
Devices[i]->shutdown(Devices[i]);
|
||||
|
||||
/* XXX this potentially leaks Devices[i]->private if it's being
|
||||
* used to point to something dynamic, but you're not supposed
|
||||
* to call this routine at such times that some open instance
|
||||
* has its private ptr pointing somewhere anyway. XXX
|
||||
*/
|
||||
free(Devices[i]);
|
||||
}
|
||||
Devices[numDevs = 0] = NULL;
|
||||
}
|
||||
|
||||
/* Get all device information for devices we have attached */
|
||||
void
|
||||
deviceGetAll(void)
|
||||
|
|
@ -417,6 +436,14 @@ skipif:
|
|||
}
|
||||
}
|
||||
|
||||
/* Rescan all devices, after closing previous set - convenience function */
|
||||
void
|
||||
deviceRescan(void)
|
||||
{
|
||||
deviceReset();
|
||||
deviceGetAll();
|
||||
}
|
||||
|
||||
/*
|
||||
* Find all devices that match the criteria, allowing "wildcarding" as well
|
||||
* by allowing NULL or ANY values to match all. The array returned is static
|
||||
|
|
|
|||
|
|
@ -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.62 1999/02/02 16:57:55 jkh Exp $
|
||||
* $Id: index.c,v 1.63 1999/02/15 04:57:07 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -475,13 +475,15 @@ pkg_fire(dialogMenuItem *self)
|
|||
else if (ie->depc == 0) {
|
||||
WINDOW *save = savescr();
|
||||
|
||||
if (!msgYesNo("Do you really want to delete %s from the system?", kp->name))
|
||||
if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name))
|
||||
if (!msgYesNo("Do you really want to delete %s from the system?", kp->name)) {
|
||||
if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name)) {
|
||||
msgConfirm("Warning: pkg_delete of %s failed.\n Check debug output for details.", kp->name);
|
||||
}
|
||||
else {
|
||||
ie->installed = 0;
|
||||
index_recorddeps(FALSE, lists->root, ie);
|
||||
}
|
||||
}
|
||||
restorescr(save);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -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: options.c,v 1.56 1997/07/16 05:22:42 jkh Exp $
|
||||
* $Id: options.c,v 1.57 1999/02/05 22:15:51 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -141,6 +141,8 @@ static Option Options[] = {
|
|||
OPT_IS_VAR, GATED_PKG_PROMPT, VAR_GATED_PKG, varCheck },
|
||||
{ "PCNFSD package", "The name of the PCNFSD package to install if requested",
|
||||
OPT_IS_VAR, PCNFSD_PKG_PROMPT, VAR_PCNFSD_PKG, varCheck },
|
||||
{ "Re-scan Devices", "Re-run sysinstall's initial device probe",
|
||||
OPT_IS_FUNC, deviceRescan },
|
||||
{ "Use Defaults", "Reset all values to startup defaults",
|
||||
OPT_IS_FUNC, installVarDefaults, 0, resetLogo },
|
||||
{ NULL },
|
||||
|
|
|
|||
|
|
@ -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.158 1999/02/09 22:18:10 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.159 1999/03/19 10:54:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -429,6 +429,8 @@ extern int crc(int, unsigned long *, unsigned long *);
|
|||
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d),
|
||||
int (*check)(dialogMenuItem *d));
|
||||
extern void deviceGetAll(void);
|
||||
extern void deviceReset(void);
|
||||
extern void deviceRescan(void);
|
||||
extern Device **deviceFind(char *name, DeviceType type);
|
||||
extern Device **deviceFindDescr(char *name, char *desc, DeviceType class);
|
||||
extern int deviceCount(Device **devs);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: devices.c,v 1.87 1998/12/04 18:01:10 wpaul Exp $
|
||||
* $Id: devices.c,v 1.88 1999/01/09 18:12:06 wpaul Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -202,6 +202,25 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e
|
|||
return newdev;
|
||||
}
|
||||
|
||||
/* Reset the registered device chain */
|
||||
void
|
||||
deviceReset(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numDevs; i++) {
|
||||
Devices[i]->shutdown(Devices[i]);
|
||||
|
||||
/* XXX this potentially leaks Devices[i]->private if it's being
|
||||
* used to point to something dynamic, but you're not supposed
|
||||
* to call this routine at such times that some open instance
|
||||
* has its private ptr pointing somewhere anyway. XXX
|
||||
*/
|
||||
free(Devices[i]);
|
||||
}
|
||||
Devices[numDevs = 0] = NULL;
|
||||
}
|
||||
|
||||
/* Get all device information for devices we have attached */
|
||||
void
|
||||
deviceGetAll(void)
|
||||
|
|
@ -417,6 +436,14 @@ skipif:
|
|||
}
|
||||
}
|
||||
|
||||
/* Rescan all devices, after closing previous set - convenience function */
|
||||
void
|
||||
deviceRescan(void)
|
||||
{
|
||||
deviceReset();
|
||||
deviceGetAll();
|
||||
}
|
||||
|
||||
/*
|
||||
* Find all devices that match the criteria, allowing "wildcarding" as well
|
||||
* by allowing NULL or ANY values to match all. The array returned is static
|
||||
|
|
|
|||
|
|
@ -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.158 1999/02/09 22:18:10 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.159 1999/03/19 10:54:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -429,6 +429,8 @@ extern int crc(int, unsigned long *, unsigned long *);
|
|||
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d),
|
||||
int (*check)(dialogMenuItem *d));
|
||||
extern void deviceGetAll(void);
|
||||
extern void deviceReset(void);
|
||||
extern void deviceRescan(void);
|
||||
extern Device **deviceFind(char *name, DeviceType type);
|
||||
extern Device **deviceFindDescr(char *name, char *desc, DeviceType class);
|
||||
extern int deviceCount(Device **devs);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* This is probably the last program in the `sysinstall' line - the next
|
||||
* generation being essentially a complete rewrite.
|
||||
*
|
||||
* $Id: devices.c,v 1.87 1998/12/04 18:01:10 wpaul Exp $
|
||||
* $Id: devices.c,v 1.88 1999/01/09 18:12:06 wpaul Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -202,6 +202,25 @@ deviceRegister(char *name, char *desc, char *devname, DeviceType type, Boolean e
|
|||
return newdev;
|
||||
}
|
||||
|
||||
/* Reset the registered device chain */
|
||||
void
|
||||
deviceReset(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < numDevs; i++) {
|
||||
Devices[i]->shutdown(Devices[i]);
|
||||
|
||||
/* XXX this potentially leaks Devices[i]->private if it's being
|
||||
* used to point to something dynamic, but you're not supposed
|
||||
* to call this routine at such times that some open instance
|
||||
* has its private ptr pointing somewhere anyway. XXX
|
||||
*/
|
||||
free(Devices[i]);
|
||||
}
|
||||
Devices[numDevs = 0] = NULL;
|
||||
}
|
||||
|
||||
/* Get all device information for devices we have attached */
|
||||
void
|
||||
deviceGetAll(void)
|
||||
|
|
@ -417,6 +436,14 @@ skipif:
|
|||
}
|
||||
}
|
||||
|
||||
/* Rescan all devices, after closing previous set - convenience function */
|
||||
void
|
||||
deviceRescan(void)
|
||||
{
|
||||
deviceReset();
|
||||
deviceGetAll();
|
||||
}
|
||||
|
||||
/*
|
||||
* Find all devices that match the criteria, allowing "wildcarding" as well
|
||||
* by allowing NULL or ANY values to match all. The array returned is static
|
||||
|
|
|
|||
|
|
@ -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.62 1999/02/02 16:57:55 jkh Exp $
|
||||
* $Id: index.c,v 1.63 1999/02/15 04:57:07 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -475,13 +475,15 @@ pkg_fire(dialogMenuItem *self)
|
|||
else if (ie->depc == 0) {
|
||||
WINDOW *save = savescr();
|
||||
|
||||
if (!msgYesNo("Do you really want to delete %s from the system?", kp->name))
|
||||
if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name))
|
||||
if (!msgYesNo("Do you really want to delete %s from the system?", kp->name)) {
|
||||
if (vsystem("pkg_delete %s %s", isDebug() ? "-v" : "", kp->name)) {
|
||||
msgConfirm("Warning: pkg_delete of %s failed.\n Check debug output for details.", kp->name);
|
||||
}
|
||||
else {
|
||||
ie->installed = 0;
|
||||
index_recorddeps(FALSE, lists->root, ie);
|
||||
}
|
||||
}
|
||||
restorescr(save);
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -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: options.c,v 1.56 1997/07/16 05:22:42 jkh Exp $
|
||||
* $Id: options.c,v 1.57 1999/02/05 22:15:51 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -141,6 +141,8 @@ static Option Options[] = {
|
|||
OPT_IS_VAR, GATED_PKG_PROMPT, VAR_GATED_PKG, varCheck },
|
||||
{ "PCNFSD package", "The name of the PCNFSD package to install if requested",
|
||||
OPT_IS_VAR, PCNFSD_PKG_PROMPT, VAR_PCNFSD_PKG, varCheck },
|
||||
{ "Re-scan Devices", "Re-run sysinstall's initial device probe",
|
||||
OPT_IS_FUNC, deviceRescan },
|
||||
{ "Use Defaults", "Reset all values to startup defaults",
|
||||
OPT_IS_FUNC, installVarDefaults, 0, resetLogo },
|
||||
{ NULL },
|
||||
|
|
|
|||
|
|
@ -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.158 1999/02/09 22:18:10 jkh Exp $
|
||||
* $Id: sysinstall.h,v 1.159 1999/03/19 10:54:38 jkh Exp $
|
||||
*
|
||||
* Copyright (c) 1995
|
||||
* Jordan Hubbard. All rights reserved.
|
||||
|
|
@ -429,6 +429,8 @@ extern int crc(int, unsigned long *, unsigned long *);
|
|||
extern DMenu *deviceCreateMenu(DMenu *menu, DeviceType type, int (*hook)(dialogMenuItem *d),
|
||||
int (*check)(dialogMenuItem *d));
|
||||
extern void deviceGetAll(void);
|
||||
extern void deviceReset(void);
|
||||
extern void deviceRescan(void);
|
||||
extern Device **deviceFind(char *name, DeviceType type);
|
||||
extern Device **deviceFindDescr(char *name, char *desc, DeviceType class);
|
||||
extern int deviceCount(Device **devs);
|
||||
|
|
|
|||
Loading…
Reference in a new issue