diff options
author | H. Peter Anvin <hpa@zytor.com> | 2012-06-20 16:08:53 -0700 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2012-06-20 16:08:53 -0700 |
commit | 3f51f9e151e1a0829ae6321320baa3b6e7c61877 (patch) | |
tree | 2851149ab46ad263acfea3a570a59ad3aacdbbd4 | |
parent | 6be9e52dcb80c910373cc8eaade2de13b0afed00 (diff) | |
download | syslinux-3f51f9e151e1a0829ae6321320baa3b6e7c61877.tar.gz syslinux-3f51f9e151e1a0829ae6321320baa3b6e7c61877.tar.xz syslinux-3f51f9e151e1a0829ae6321320baa3b6e7c61877.zip |
extlinux: add --device option to override device detect
Add a --device option for scripts and expert users to override the
device detection.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r-- | extlinux/main.c | 11 | ||||
-rw-r--r-- | libinstaller/syslxopt.c | 9 | ||||
-rw-r--r-- | libinstaller/syslxopt.h | 1 | ||||
-rw-r--r-- | man/extlinux.1 | 11 |
4 files changed, 27 insertions, 5 deletions
diff --git a/extlinux/main.c b/extlinux/main.c index 63751669..73f3fbe1 100644 --- a/extlinux/main.c +++ b/extlinux/main.c @@ -1028,9 +1028,14 @@ static const char *get_devname(const char *path) return devname; } - if (fs_type == BTRFS) { - /* For btrfs try to get the device name from btrfs itself */ - devname = find_device_btrfs(path); + if (opt.device) + devname = opt.device; + + if (!devname){ + if (fs_type == BTRFS) { + /* For btrfs try to get the device name from btrfs itself */ + devname = find_device_btrfs(path); + } } if (!devname) { diff --git a/libinstaller/syslxopt.c b/libinstaller/syslxopt.c index e081a00e..dde4969f 100644 --- a/libinstaller/syslxopt.c +++ b/libinstaller/syslxopt.c @@ -66,6 +66,7 @@ const struct option long_options[] = { {"menu-save", 1, NULL, 'M'}, {"mbr", 0, NULL, 'm'}, /* DOS/Win32 only */ {"active", 0, NULL, 'a'}, /* DOS/Win32 only */ + {"device", 1, NULL, OPT_DEVICE}, {0, 0, 0, 0} }; @@ -87,7 +88,8 @@ void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode) /* Mounted fs installation (extlinux) */ /* Actually extlinux can also use -d to provide a directory too... */ fprintf(stderr, - "Usage: %s [options] directory\n", + "Usage: %s [options] directory\n" + " --device Force use of a specific block device (experts only)\n" program); break; @@ -210,6 +212,11 @@ void parse_options(int argc, char *argv[], enum syslinux_mode mode) case 'a': opt.activate_partition = 1; break; + case OPT_DEVICE: + if (mode != EXTLINUX_MODE) + usage(EX_USAGE, mode); + opt.device = optarg; + break; case 'v': fprintf(stderr, "%s " VERSION_STR " Copyright 1994-" YEAR_STR diff --git a/libinstaller/syslxopt.h b/libinstaller/syslxopt.h index bcbe0352..042301f6 100644 --- a/libinstaller/syslxopt.h +++ b/libinstaller/syslxopt.h @@ -24,6 +24,7 @@ enum long_only_opt { OPT_NONE, OPT_RESET_ADV, OPT_ONCE, + OPT_DEVICE, }; enum syslinux_mode { diff --git a/man/extlinux.1 b/man/extlinux.1 index 3192122a..5daa4e52 100644 --- a/man/extlinux.1 +++ b/man/extlinux.1 @@ -45,8 +45,17 @@ Updates a previous \fBEXTLINUX\fP installation. .TP \fB\-z\fR, \fB\-\-zip\fR Force zipdrive geometry (-H 64 -S 32). +.TP +\fB\-\-device\fR=\fIdevicename\fR +Override the automatic detection of device names. This option is +intended for special environments only and should not be used by +normal users. Misuse of this option can cause disk corruption and +lost data. .SH FILES -The extlinux configuration file needs to be named extlinux.conf and needs to be stored in the extlinux installation directory. For more information about the contents of extlinux.conf, see syslinux(1) manpage, section files. +The extlinux configuration file needs to be named syslinux.cfg or +extlinux.conf and needs to be stored in the extlinux installation +directory. For more information about the contents of extlinux.conf, +see syslinux(1) manpage, section files. .SH BUGS I would appreciate hearing of any problems you have with \s-1SYSLINUX\s+1. I would also like to hear from you if you have successfully used \s-1SYSLINUX\s+1, |