Skip to content

Commit 5a92025

Browse files
yuwatabluca
authored andcommitted
journalctl: honor --quiet with --setup-keys
Closes #35504. (cherry picked from commit a5b2973) (cherry picked from commit 644f2a0) (cherry picked from commit c03e316) (cherry picked from commit dbab170) (cherry picked from commit 4c88d0e) (cherry picked from commit b125bce)
1 parent c56f6f7 commit 5a92025

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/journal/journalctl.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,15 +1865,18 @@ static int setup_keys(void) {
18651865
state_size = FSPRG_stateinbytes(FSPRG_RECOMMENDED_SECPAR);
18661866
state = alloca_safe(state_size);
18671867

1868-
log_info("Generating seed...");
1868+
if (!arg_quiet)
1869+
log_info("Generating seed...");
18691870
r = crypto_random_bytes(seed, seed_size);
18701871
if (r < 0)
18711872
return log_error_errno(r, "Failed to acquire random seed: %m");
18721873

1873-
log_info("Generating key pair...");
1874+
if (!arg_quiet)
1875+
log_info("Generating key pair...");
18741876
FSPRG_GenMK(NULL, mpk, seed, seed_size, FSPRG_RECOMMENDED_SECPAR);
18751877

1876-
log_info("Generating sealing key...");
1878+
if (!arg_quiet)
1879+
log_info("Generating sealing key...");
18771880
FSPRG_GenState0(state, mpk, seed, seed_size);
18781881

18791882
assert(arg_interval > 0);
@@ -1888,7 +1891,7 @@ static int setup_keys(void) {
18881891

18891892
r = chattr_secret(fd, CHATTR_WARN_UNSUPPORTED_FLAGS);
18901893
if (r < 0)
1891-
log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) ? LOG_DEBUG : LOG_WARNING,
1894+
log_full_errno(ERRNO_IS_NOT_SUPPORTED(r) || arg_quiet ? LOG_DEBUG : LOG_WARNING,
18921895
r, "Failed to set file attributes on '%s', ignoring: %m", k);
18931896

18941897
struct FSSHeader h = {
@@ -1921,7 +1924,7 @@ static int setup_keys(void) {
19211924
if (r < 0)
19221925
return r;
19231926

1924-
if (on_tty()) {
1927+
if (on_tty() && !arg_quiet) {
19251928
hn = gethostname_malloc();
19261929
if (hn)
19271930
hostname_cleanup(hn);
@@ -1952,7 +1955,7 @@ static int setup_keys(void) {
19521955

19531956
puts(key);
19541957

1955-
if (on_tty()) {
1958+
if (on_tty() && !arg_quiet) {
19561959
fprintf(stderr, "%s", ansi_normal());
19571960
#if HAVE_QRENCODE
19581961
_cleanup_free_ char *url = NULL;

0 commit comments

Comments
 (0)