summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extlinux/main.c9
-rw-r--r--libinstaller/syslxopt.c8
-rw-r--r--libinstaller/syslxopt.h1
-rw-r--r--man/extlinux.13
4 files changed, 19 insertions, 2 deletions
diff --git a/extlinux/main.c b/extlinux/main.c
index 0669bb9c..8a0ac63b 100644
--- a/extlinux/main.c
+++ b/extlinux/main.c
@@ -381,6 +381,13 @@ int modify_adv(void)
rv = -1;
}
}
+ if (opt.menu_save) {
+ if (syslinux_setadv(ADV_MENUSAVE, strlen(opt.menu_save), opt.menu_save)) {
+ fprintf(stderr, "%s: not enough space for menu-save label\n",
+ program);
+ rv = -1;
+ }
+ }
return rv;
}
@@ -877,7 +884,7 @@ int main(int argc, char *argv[])
usage(EX_USAGE, 0);
if (opt.update_only == -1) {
- if (opt.reset_adv || opt.set_once)
+ if (opt.reset_adv || opt.set_once || opt.menu_save)
return modify_existing_adv(opt.directory);
else
usage(EX_USAGE, 0);
diff --git a/libinstaller/syslxopt.c b/libinstaller/syslxopt.c
index 7718de3a..728b19e4 100644
--- a/libinstaller/syslxopt.c
+++ b/libinstaller/syslxopt.c
@@ -38,6 +38,7 @@ struct sys_options opt = {
.directory = NULL,
.device = NULL,
.offset = 0,
+ .menu_save = NULL,
};
const struct option long_options[] = {
@@ -55,10 +56,11 @@ const struct option long_options[] = {
{"once", 1, NULL, 'o'},
{"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:O";
+const char short_options[] = "id:f:UuzS:H:rvho:OM:";
void __attribute__ ((noreturn)) usage(int rv, int mode)
{
@@ -83,6 +85,7 @@ void __attribute__ ((noreturn)) usage(int rv, int mode)
" --once=... -o 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"
"\n"
" Note: geometry is determined at boot time for devices which\n"
" are considered hard disks by the BIOS. Unfortunately, this is\n"
@@ -155,6 +158,9 @@ void parse_options(int argc, char *argv[], int mode)
case OPT_RESET_ADV:
opt.reset_adv = 1;
break;
+ case 'M':
+ opt.menu_save = optarg;
+ break;
case 'v':
fputs(program, stderr);
fputs(" " VERSION_STR
diff --git a/libinstaller/syslxopt.h b/libinstaller/syslxopt.h
index d925fa34..dfa6dc75 100644
--- a/libinstaller/syslxopt.h
+++ b/libinstaller/syslxopt.h
@@ -13,6 +13,7 @@ struct sys_options {
const char *directory;
const char *device;
unsigned int offset;
+ const char *menu_save;
};
enum long_only_opt {
diff --git a/man/extlinux.1 b/man/extlinux.1
index 426eeb37..c29f5246 100644
--- a/man/extlinux.1
+++ b/man/extlinux.1
@@ -28,6 +28,9 @@ Clear the boot-once command.
\fB\-o\fR, \fB\-\-once\fR=\fIcommand\fR
Execute a command once upon boot.
.TP
+\fB\-M\fR, \fB\-\-menu\-save\fR=\fIlabel\fR
+Set the label to select as default on the next boot
+.TP
\fB\-r\fR, \fB\-\-raid\fR
Fall back to the next device on boot failure.
.TP