]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
bootctl: highlight SecureBoot enabled state in green 29359/head
authorLennart Poettering <lennart@poettering.net>
Thu, 28 Sep 2023 08:45:49 +0000 (10:45 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 28 Sep 2023 10:07:15 +0000 (12:07 +0200)
src/basic/string-util.h
src/boot/bootctl-status.c

index 72f791f6ccb92c2905570e6b73684173275b6c10..6b6a5746fe64fe9949aa603c082228dcb91788fd 100644 (file)
@@ -68,6 +68,10 @@ static inline const char* enable_disable(bool b) {
         return b ? "enable" : "disable";
 }
 
+static inline const char* enabled_disabled(bool b) {
+        return b ? "enabled" : "disabled";
+}
+
 /* This macro's return pointer will have the "const" qualifier set or unset the same way as the input
  * pointer. */
 #define empty_to_null(p)                                \
index 00bc0a91c2c26133be056976f5b9f2ab80b0c072..033abb056657ad46866c68c520830a36ed798f79 100644 (file)
@@ -410,9 +410,15 @@ int verb_status(int argc, char *argv[], void *userdata) {
                 printf("%sSystem:%s\n", ansi_underline(), ansi_normal());
                 printf("      Firmware: %s%s (%s)%s\n", ansi_highlight(), strna(fw_type), strna(fw_info), ansi_normal());
                 printf(" Firmware Arch: %s\n", get_efi_arch());
-                printf("   Secure Boot: %sd (%s)\n",
-                       enable_disable(IN_SET(secure, SECURE_BOOT_USER, SECURE_BOOT_DEPLOYED)),
-                       secure_boot_mode_to_string(secure));
+                printf("   Secure Boot: %s%s%s",
+                       IN_SET(secure, SECURE_BOOT_USER, SECURE_BOOT_DEPLOYED) ? ansi_highlight_green() : ansi_normal(),
+                       enabled_disabled(IN_SET(secure, SECURE_BOOT_USER, SECURE_BOOT_DEPLOYED)),
+                       ansi_normal());
+
+                if (secure != SECURE_BOOT_DISABLED)
+                        printf(" (%s)\n", secure_boot_mode_to_string(secure));
+                else
+                        printf("\n");
 
                 s = tpm2_support();
                 printf("  TPM2 Support: %s%s%s\n",