chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
tree-wide: Always use recvmsg with MSG_CMSG_CLOEXEC
[elogind.git]
/
src
/
boot
/
bootctl.c
diff --git
a/src/boot/bootctl.c
b/src/boot/bootctl.c
index b916012b40cfa5d8f244c41c79a0c66edcdd9b15..51b51c4254cf34ecd13fe933b47270ade7f1661b 100644
(file)
--- a/
src/boot/bootctl.c
+++ b/
src/boot/bootctl.c
@@
-32,16
+32,14
@@
#include "util.h"
#include "utf8.h"
#include "util.h"
#include "utf8.h"
-static
int
help(void) {
+static
void
help(void) {
printf("%s [OPTIONS...] COMMAND ...\n\n"
printf("%s [OPTIONS...] COMMAND ...\n\n"
- "Query or change firmware and boot mana
n
ger settings.\n\n"
+ "Query or change firmware and boot manager settings.\n\n"
" -h --help Show this help\n"
" --version Show package version\n"
"Commands:\n"
" -h --help Show this help\n"
" --version Show package version\n"
"Commands:\n"
- " status Show current time settings\n",
- program_invocation_short_name);
-
- return 0;
+ " status Show current boot settings\n"
+ , program_invocation_short_name);
}
static int parse_argv(int argc, char *argv[]) {
}
static int parse_argv(int argc, char *argv[]) {
@@
-50,16
+48,17
@@
static int parse_argv(int argc, char *argv[]) {
};
static const struct option options[] = {
};
static const struct option options[] = {
- { "help",
no_argument, NULL, 'h'
},
- { "version",
no_argument, NULL, ARG_VERSION
},
- {
NULL, 0, NULL, 0
}
+ { "help",
no_argument, NULL, 'h'
},
+ { "version",
no_argument, NULL, ARG_VERSION
},
+ {}
};
int c;
assert(argc >= 0);
assert(argv);
};
int c;
assert(argc >= 0);
assert(argv);
- while ((c = getopt_long(argc, argv, "+hH:P", options, NULL)) >= 0) {
+
+ while ((c = getopt_long(argc, argv, "h", options, NULL)) >= 0)
switch (c) {
switch (c) {
@@
-76,10
+75,8
@@
static int parse_argv(int argc, char *argv[]) {
return -EINVAL;
default:
return -EINVAL;
default:
- log_error("Unknown option code %c", c);
- return -EINVAL;
+ assert_not_reached("Unhandled option");
}
}
- }
return 1;
}
return 1;
}
@@
-143,45
+140,48
@@
static int show_status(char **args, unsigned n) {
err = boot_info_query(info);
err = boot_info_query(info);
- printf("
Machine
:\n");
- printf("
ID: %s\n", sd_id128_to_string(info->machine_id, buf));
+ printf("
System
:\n");
+ printf("
Machine
ID: %s\n", sd_id128_to_string(info->machine_id, buf));
printf(" Boot ID: %s\n", sd_id128_to_string(info->boot_id, buf));
printf(" Boot ID: %s\n", sd_id128_to_string(info->boot_id, buf));
- printf("\n");
-
- printf("Firmware:\n");
if (info->fw_type)
if (info->fw_type)
- printf(" Type: %s (%s)\n", info->fw_type, strna(info->fw_info));
-
+ printf(" Firmware: %s (%s)\n", info->fw_type, strna(info->fw_info));
if (info->fw_secure_boot >= 0)
printf(" Secure Boot: %s\n", info->fw_secure_boot ? "enabled" : "disabled");
if (info->fw_secure_boot_setup_mode >= 0)
printf(" Setup Mode: %s\n", info->fw_secure_boot_setup_mode ? "setup" : "user");
if (info->fw_secure_boot >= 0)
printf(" Secure Boot: %s\n", info->fw_secure_boot ? "enabled" : "disabled");
if (info->fw_secure_boot_setup_mode >= 0)
printf(" Setup Mode: %s\n", info->fw_secure_boot_setup_mode ? "setup" : "user");
+ printf("\n");
if (info->fw_entry_active >= 0) {
if (info->fw_entry_active >= 0) {
+ printf("Selected Firmware Entry:\n");
printf(" Title: %s\n", strna(info->fw_entries[info->fw_entry_active].title));
printf(" Title: %s\n", strna(info->fw_entries[info->fw_entry_active].title));
- if (info->fw_entries[info->fw_entry_active].path)
- printf(" Binary: %s\n", info->fw_entries[info->fw_entry_active].path);
if (!sd_id128_equal(info->fw_entries[info->fw_entry_active].part_uuid, SD_ID128_NULL))
printf(" Partition: /dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
SD_ID128_FORMAT_VAL(info->fw_entries[info->fw_entry_active].part_uuid));
if (!sd_id128_equal(info->fw_entries[info->fw_entry_active].part_uuid, SD_ID128_NULL))
printf(" Partition: /dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
SD_ID128_FORMAT_VAL(info->fw_entries[info->fw_entry_active].part_uuid));
+ else
+ printf(" Partition: n/a\n");
+ if (info->fw_entries[info->fw_entry_active].path)
+ printf(" File: %s%s\n", draw_special_char(DRAW_TREE_RIGHT), info->fw_entries[info->fw_entry_active].path);
}
printf("\n");
if (info->loader) {
}
printf("\n");
if (info->loader) {
- printf("Boot loader:\n");
- printf(" Type: %s\n", info->loader);
- printf(" Binary: %s\n", strna(info->loader_image_path));
+ printf("Boot Loader:\n");
+ printf(" Product: %s\n", info->loader);
if (!sd_id128_equal(info->loader_part_uuid, SD_ID128_NULL))
printf(" Partition: /dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
SD_ID128_FORMAT_VAL(info->loader_part_uuid));
if (!sd_id128_equal(info->loader_part_uuid, SD_ID128_NULL))
printf(" Partition: /dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
SD_ID128_FORMAT_VAL(info->loader_part_uuid));
+ else
+ printf(" Partition: n/a\n");
+ printf(" File: %s%s\n", draw_special_char(DRAW_TREE_RIGHT), strna(info->loader_image_path));
+ printf("\n");
if (info->loader_entry_active >= 0) {
if (info->loader_entry_active >= 0) {
+ printf("Selected Boot Loader Entry:\n");
printf(" Title: %s\n", strna(info->loader_entries[info->loader_entry_active].title));
printf(" Title: %s\n", strna(info->loader_entries[info->loader_entry_active].title));
- printf(" Entry: %s\n", info->loader_entries[info->loader_entry_active].path);
+ printf(" File: %s\n", info->loader_entries[info->loader_entry_active].path);
+ if (info->loader_options_added)
+ printf(" Options: %s\n", info->loader_options_added);
}
}
-
- if (info->loader_options_added)
- printf(" Options: %s\n", info->loader_options_added);
} else
printf("No suitable data is provided by the boot manager. See:\n"
" http://www.freedesktop.org/wiki/Software/systemd/BootLoaderInterface\n"
} else
printf("No suitable data is provided by the boot manager. See:\n"
" http://www.freedesktop.org/wiki/Software/systemd/BootLoaderInterface\n"
@@
-265,21
+265,17
@@
static int bootctl_main(int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
}
int main(int argc, char *argv[]) {
- int r
, retval = EXIT_FAILURE
;
+ int r;
log_parse_environment();
log_open();
r = parse_argv(argc, argv);
log_parse_environment();
log_open();
r = parse_argv(argc, argv);
- if (r < 0)
+ if (r <
=
0)
goto finish;
goto finish;
- else if (r == 0) {
- retval = EXIT_SUCCESS;
- goto finish;
- }
r = bootctl_main(argc, argv);
r = bootctl_main(argc, argv);
- retval = r < 0 ? EXIT_FAILURE : r;
-finish:
- return r
etval
;
+
+
finish:
+ return r
< 0 ? EXIT_FAILURE : EXIT_SUCCESS
;
}
}