-/* Global option handling */
-/* Global fs_type for handling fat, ext2/3/4 and btrfs */
-static enum filesystem {
- NONE,
- EXT2,
- BTRFS,
- VFAT,
-} fs_type;
-
-const char *program;
-
-/* These are the options we can set and their values */
-struct my_options {
- unsigned int sectors;
- unsigned int heads;
- int raid_mode;
- int stupid_mode;
- int reset_adv;
- const char *set_once;
-} opt = {
-.sectors = 0,.heads = 0,.raid_mode = 0,.stupid_mode = 0,.reset_adv =
- 0,.set_once = NULL,};
-
-static void __attribute__ ((noreturn)) usage(int rv)
-{
- fprintf(stderr,
- "Usage: %s [options] directory\n"
- " --install -i Install over the current bootsector\n"
- " --update -U Update a previous EXTLINUX installation\n"
- " --zip -z Force zipdrive geometry (-H 64 -S 32)\n"
- " --sectors=# -S Force the number of sectors per track\n"
- " --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"
- " --clear-once -O Clear the boot-once command\n"
- " --reset-adv Reset auxilliary data\n"
- "\n"
- " Note: geometry is determined at boot time for devices which\n"
- " are considered hard disks by the BIOS. Unfortunately, this is\n"
- " not possible for devices which are considered floppy disks,\n"
- " 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",
- program);
-
- exit(rv);
-}
-
-enum long_only_opt {
- OPT_NONE,
- OPT_RESET_ADV,
-};
-
-static const struct option long_options[] = {
- {"install", 0, NULL, 'i'},
- {"update", 0, NULL, 'U'},
- {"zipdrive", 0, NULL, 'z'},
- {"sectors", 1, NULL, 'S'},
- {"stupid", 0, NULL, 's'},
- {"heads", 1, NULL, 'H'},
- {"raid-mode", 0, NULL, 'r'},
- {"version", 0, NULL, 'v'},
- {"help", 0, NULL, 'h'},
- {"once", 1, NULL, 'o'},
- {"clear-once", 0, NULL, 'O'},
- {"reset-adv", 0, NULL, OPT_RESET_ADV},
- {0, 0, 0, 0}
-};
-
-static const char short_options[] = "iUuzS:H:rvho:O";
-