aboutsummaryrefslogtreecommitdiffstats
path: root/libinstaller/syslxopt.c
diff options
context:
space:
mode:
Diffstat (limited to 'libinstaller/syslxopt.c')
-rw-r--r--libinstaller/syslxopt.c43
1 files changed, 31 insertions, 12 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 = "";