aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShao Miller <shao.miller@yrdsb.edu.on.ca>2010-07-03 03:47:25 -0400
committerShao Miller <shao.miller@yrdsb.edu.on.ca>2010-07-09 21:26:23 -0700
commit07b70a5266d694c954082b301a205225a892184f (patch)
treed9ca30ee4563ccac6c566b9539197623ef59b8ea
parent0ee50473e37cbc22ef1b2f9897bce48c41be8f5e (diff)
downloadhdt-pierre-07b70a5266d694c954082b301a205225a892184f.tar.gz
hdt-pierre-07b70a5266d694c954082b301a205225a892184f.tar.xz
hdt-pierre-07b70a5266d694c954082b301a205225a892184f.zip
libinstaller: Add --mbr, --active, and --force options
In order to consolidate the installer option-parsing system, we add the --mbr (-m), --active (-a), and --force (-f) options from the DOS, Win32, and mtools installers to libinstaller. Since the -m and -a options are not currently valid for the Linux 'syslinux' and 'extlinux' installers, we add error messages to both of these. The -f option is allowed but does nothing for them. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
-rw-r--r--extlinux/main.c2
-rw-r--r--libinstaller/syslxopt.c19
-rw-r--r--libinstaller/syslxopt.h3
-rw-r--r--linux/syslinux.c2
4 files changed, 22 insertions, 4 deletions
diff --git a/extlinux/main.c b/extlinux/main.c
index daebc101..a541e38a 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -809,7 +809,7 @@ int main(int argc, char *argv[])
{
parse_options(argc, argv, MODE_EXTLINUX);
- if (!opt.directory)
+ if (!opt.directory || opt.install_mbr || opt.activate_partition || opt.force)
usage(EX_USAGE, 0);
if (opt.update_only == -1) {
diff --git a/libinstaller/syslxopt.c b/libinstaller/syslxopt.c
index 0ff2efbb..8aee160e 100644
--- a/libinstaller/syslxopt.c
+++ b/libinstaller/syslxopt.c
@@ -40,10 +40,13 @@ struct sys_options opt = {
.device = NULL,
.offset = 0,
.menu_save = NULL,
+ .install_mbr = 0,
+ .activate_partition = 0,
+ .force = 0,
};
const struct option long_options[] = {
- {"force", 0, NULL, 'f'}, /* dummy option for compatibility */
+ {"force", 0, NULL, 'f'}, /* DOS/Win32/mtools only */
{"install", 0, NULL, 'i'},
{"directory", 1, NULL, 'd'},
{"offset", 1, NULL, 't'},
@@ -59,10 +62,12 @@ const struct option long_options[] = {
{"clear-once", 0, NULL, 'O'},
{"reset-adv", 0, NULL, OPT_RESET_ADV},
{"menu-save", 1, NULL, 'M'},
+ {"mbr", 0, NULL, 'm'}, /* DOS/Win32 only */
+ {"active", 0, NULL, 'a'}, /* DOS/Win32 only */
{0, 0, 0, 0}
};
-const char short_options[] = "t:fid:UuzS:H:rvho:OM:";
+const char short_options[] = "t:fid:UuzS:H:rvho:OM:ma";
void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
{
@@ -97,6 +102,9 @@ void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
" --clear-once -O Clear the boot-once command\n"
" --reset-adv Reset auxilliary data\n"
" --menu-save= -M Set the label to select as default on the next boot\n"
+ " --mbr -m Install an MBR (DOS/Win32 installers only)\n"
+ " --active -a Mark partition as active (DOS/Win32 installers only)\n"
+ " --force -f Ignore precautions (DOS/Win32/mtools installers only)\n"
"\n"
" Note: geometry is determined at boot time for devices which\n"
" are considered hard disks by the BIOS. Unfortunately, this is\n"
@@ -119,6 +127,7 @@ void parse_options(int argc, char *argv[], enum syslinux_mode mode)
long_options, NULL)) != EOF) {
switch (o) {
case 'f':
+ opt.force = 1;
break;
case 'z':
opt.heads = 64;
@@ -183,6 +192,12 @@ void parse_options(int argc, char *argv[], enum syslinux_mode mode)
case 'M':
opt.menu_save = optarg;
break;
+ case 'm':
+ opt.install_mbr = 1;
+ break;
+ case 'a':
+ opt.activate_partition = 1;
+ break;
case 'v':
fprintf(stderr,
"%s " VERSION_STR " Copyright 1994-" YEAR_STR
diff --git a/libinstaller/syslxopt.h b/libinstaller/syslxopt.h
index 446ab9af..6fdf1d98 100644
--- a/libinstaller/syslxopt.h
+++ b/libinstaller/syslxopt.h
@@ -14,6 +14,9 @@ struct sys_options {
const char *device;
unsigned int offset;
const char *menu_save;
+ int force;
+ int install_mbr;
+ int activate_partition;
};
enum long_only_opt {
diff --git a/linux/syslinux.c b/linux/syslinux.c
index 9462138f..9807bdf0 100644
--- a/linux/syslinux.c
+++ b/linux/syslinux.c
@@ -273,7 +273,7 @@ int main(int argc, char *argv[])
subdir = "/";
}
- if (!opt.device)
+ if (!opt.device || opt.install_mbr || opt.activate_partition || opt.force)
usage(EX_USAGE, MODE_SYSLINUX);
/*