diff options
author | jkim <jkim@FreeBSD.org> | 2006-01-27 21:00:31 +0000 |
---|---|---|
committer | jkim <jkim@FreeBSD.org> | 2006-01-27 21:00:31 +0000 |
commit | 2696c9b917d23fe657d74ed0da554cc778a6a7df (patch) | |
tree | 779e8f0fda55c6dc317a4e9f4ac1b1da15d6a532 /usr.sbin/sysinstall | |
parent | 40c7d835b9c0f0875af9bbcd1a9f8e838f5a3ca1 (diff) | |
download | FreeBSD-src-2696c9b917d23fe657d74ed0da554cc778a6a7df.zip FreeBSD-src-2696c9b917d23fe657d74ed0da554cc778a6a7df.tar.gz |
Add `mediaOpen' function. This function mounts selected media device.
For example, you can dynamically generate and load configuration file
depending on the hardware configuration with the following template:
mediaSetCDROM
mediaOpen
command='/dist/rescue/sh /dist/scripts/install.sh'
system
mediaClose
configFile=/tmp/generated.cfg
loadConfig
Now we have full access to files on the media before installation begins.
Diffstat (limited to 'usr.sbin/sysinstall')
-rw-r--r-- | usr.sbin/sysinstall/dispatch.c | 8 | ||||
-rw-r--r-- | usr.sbin/sysinstall/media.c | 8 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.8 | 5 | ||||
-rw-r--r-- | usr.sbin/sysinstall/sysinstall.h | 1 |
4 files changed, 22 insertions, 0 deletions
diff --git a/usr.sbin/sysinstall/dispatch.c b/usr.sbin/sysinstall/dispatch.c index 4896b23..b1d0099 100644 --- a/usr.sbin/sysinstall/dispatch.c +++ b/usr.sbin/sysinstall/dispatch.c @@ -45,6 +45,7 @@ static int dispatch_shutdown(dialogMenuItem *unused); static int dispatch_systemExecute(dialogMenuItem *unused); static int dispatch_msgConfirm(dialogMenuItem *unused); +static int dispatch_mediaOpen(dialogMenuItem *unused); static int dispatch_mediaClose(dialogMenuItem *unused); static struct _word { @@ -91,6 +92,7 @@ static struct _word { { "installVarDefaults", installVarDefaults }, { "loadConfig", dispatch_load_file }, { "loadFloppyConfig", dispatch_load_floppy }, + { "mediaOpen", dispatch_mediaOpen }, { "mediaClose", dispatch_mediaClose }, { "mediaSetCDROM", mediaSetCDROM }, { "mediaSetFloppy", mediaSetFloppy }, @@ -204,6 +206,12 @@ dispatch_msgConfirm(dialogMenuItem *unused) } static int +dispatch_mediaOpen(dialogMenuItem *unused) +{ + return mediaOpen(); +} + +static int dispatch_mediaClose(dialogMenuItem *unused) { mediaClose(); diff --git a/usr.sbin/sysinstall/media.c b/usr.sbin/sysinstall/media.c index cbdc01c..8e61c5a 100644 --- a/usr.sbin/sysinstall/media.c +++ b/usr.sbin/sysinstall/media.c @@ -122,6 +122,14 @@ cpioVerbosity() return ""; } +int +mediaOpen(void) +{ + if (!mediaDevice || !mediaVerify() || !DEVICE_INIT(mediaDevice)) + return DITEM_FAILURE; + return DITEM_SUCCESS; +} + void mediaClose(void) { diff --git a/usr.sbin/sysinstall/sysinstall.8 b/usr.sbin/sysinstall/sysinstall.8 index aeb268e..378359d 100644 --- a/usr.sbin/sysinstall/sysinstall.8 +++ b/usr.sbin/sysinstall/sysinstall.8 @@ -629,6 +629,11 @@ configuration file from another. .It configFile The fully qualified pathname of the file to load. .El +.It mediaOpen +If a media device is set, mount it. +.Pp +.Sy Variables : +None .It mediaClose If a media device is open, close it. .Pp diff --git a/usr.sbin/sysinstall/sysinstall.h b/usr.sbin/sysinstall/sysinstall.h index d099cca..3dfc048 100644 --- a/usr.sbin/sysinstall/sysinstall.h +++ b/usr.sbin/sysinstall/sysinstall.h @@ -702,6 +702,7 @@ extern u_char default_scrnmap[]; /* media.c */ extern char *cpioVerbosity(void); +extern int mediaOpen(void); extern void mediaClose(void); extern int mediaTimeout(void); extern int mediaSetCDROM(dialogMenuItem *self); |