summaryrefslogtreecommitdiff
path: root/libinstaller
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-09 17:20:10 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-09 17:22:54 -0700
commit064b36baf1da53a709d1598209b025fcd4494d27 (patch)
treecdc99acd6d9fb97a3aa6dab969ae5c0640976880 /libinstaller
parent8ae3122d64ef1434b2b11b25cacd77d65663b3fa (diff)
downloadsyslinux-064b36baf1da53a709d1598209b025fcd4494d27.tar.gz
syslinux: don't break -o just yet; print warning and resume
-o has been supported for a very long time; recommend using -t instead, but for now proceed with an error message. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'libinstaller')
-rw-r--r--libinstaller/syslxopt.c43
-rw-r--r--libinstaller/syslxopt.h10
2 files changed, 39 insertions, 14 deletions
diff --git a/libinstaller/syslxopt.c b/libinstaller/syslxopt.c
index 728b19e4..6b23a612 100644
--- a/libinstaller/syslxopt.c
+++ b/libinstaller/syslxopt.c
@@ -42,9 +42,10 @@ struct sys_options opt = {
};
const struct option long_options[] = {
+ {"force", 0, NULL, 'f'}, /* dummy option for compatibility */
{"install", 0, NULL, 'i'},
{"directory", 1, NULL, 'd'},
- {"offset", 1, NULL, 'f'},
+ {"offset", 1, NULL, 't'},
{"update", 0, NULL, 'U'},
{"zipdrive", 0, NULL, 'z'},
{"sectors", 1, NULL, 'S'},
@@ -53,27 +54,36 @@ const struct option long_options[] = {
{"raid-mode", 0, NULL, 'r'},
{"version", 0, NULL, 'v'},
{"help", 0, NULL, 'h'},
- {"once", 1, NULL, 'o'},
+ {"once", 1, NULL, OPT_ONCE},
{"clear-once", 0, NULL, 'O'},
{"reset-adv", 0, NULL, OPT_RESET_ADV},
{"menu-save", 1, NULL, 'M'},
{0, 0, 0, 0}
};
-const char short_options[] = "id:f:UuzS:H:rvho:OM:";
+const char short_options[] = "tfid:UuzS:H:rvho:OM:";
-void __attribute__ ((noreturn)) usage(int rv, int mode)
+void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode)
{
- if (mode) /* for unmounted fs installation */
+ switch (mode) {
+ case MODE_SYSLINUX:
+ /* For unmounted fs installation (syslinux) */
fprintf(stderr,
"Usage: %s [options] device\n"
- " --offset -f Offset of the file system on the device \n"
+ " --offset -t Offset of the file system on the device \n"
" --directory -d Directory for installation target\n",
program);
- else /* actually extlinux can also use -d to provide directory too */
+ break;
+
+ case MODE_EXTLINUX:
+ /* Mounted fs installation (extlinux) */
+ /* Actually extlinux can also use -d to provide a directory too... */
fprintf(stderr,
"Usage: %s [options] directory\n",
program);
+ break;
+ }
+
fprintf(stderr,
" --install -i Install over the current bootsector\n"
" --update -U Update a previous EXTLINUX installation\n"
@@ -82,7 +92,7 @@ void __attribute__ ((noreturn)) usage(int rv, int mode)
" --heads=# -H Force number of heads\n"
" --stupid -s Slow, safe and stupid mode\n"
" --raid -r Fall back to the next device on boot failure\n"
- " --once=... -o Execute a command once upon boot\n"
+ " --once=... %s Execute a command once upon boot\n"
" --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"
@@ -93,13 +103,13 @@ void __attribute__ ((noreturn)) usage(int rv, int mode)
" which includes zipdisks and LS-120 superfloppies.\n"
"\n"
" The -z option is useful for USB devices which are considered\n"
- " hard disks by some BIOSes and zipdrives by other BIOSes.\n"
- );
+ " hard disks by some BIOSes and zipdrives by other BIOSes.\n",
+ mode == MODE_SYSLINUX ? " " : "-o");
exit(rv);
}
-void parse_options(int argc, char *argv[], int mode)
+void parse_options(int argc, char *argv[], enum syslinux_mode mode)
{
int o;
@@ -107,6 +117,8 @@ void parse_options(int argc, char *argv[], int mode)
while ((o = getopt_long(argc, argv, short_options,
long_options, NULL)) != EOF) {
switch (o) {
+ case 'f':
+ break;
case 'z':
opt.heads = 64;
opt.sectors = 32;
@@ -146,9 +158,16 @@ void parse_options(int argc, char *argv[], int mode)
usage(0, mode);
break;
case 'o':
+ if (mode == MODE_SYSLINUX) {
+ fprintf(stderr, "Warning: -o will change meaning in a future version, use -t or --offset\n");
+ goto opt_offset;
+ }
+ /* else fall through */
+ case OPT_ONCE:
opt.set_once = optarg;
break;
- case 'f':
+ case 't':
+opt_offset:
opt.offset = strtoul(optarg, NULL, 0);
case 'O':
opt.set_once = "";
diff --git a/libinstaller/syslxopt.h b/libinstaller/syslxopt.h
index dfa6dc75..ba60ce2f 100644
--- a/libinstaller/syslxopt.h
+++ b/libinstaller/syslxopt.h
@@ -19,10 +19,16 @@ struct sys_options {
enum long_only_opt {
OPT_NONE,
OPT_RESET_ADV,
+ OPT_ONCE,
};
-void __attribute__ ((noreturn)) usage(int rv, int mode);
-void parse_options(int argc, char *argv[], int mode);
+enum syslinux_mode {
+ MODE_SYSLINUX, /* Unmounted filesystem */
+ MODE_EXTLINUX,
+};
+
+void __attribute__ ((noreturn)) usage(int rv, enum syslinux_mode mode);
+void parse_options(int argc, char *argv[], enum syslinux_mode mode);
extern struct sys_options opt;
extern const struct option long_options[];