Re: Silencing ostree-prepare-root

On Fri, Mar 30, 2018, at 1:56 AM, Alex Kiernan wrote:
I'm trying to completely silence my boot, one of the messages I've got left is:

  Examining ///ostree/boot.1/nano/
  Resolved OSTree target to:

Parsing out an additional kernel command line parameter is obviously
easy, but is that a sensible approach? Picking say 'quiet' seems like
an obvious option, but any thoughts?

If this looks good to you I can toss it into a PR:

diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
index a5c3c785..d8fa73c2 100644
--- a/src/switchroot/ostree-prepare-root.c
+++ b/src/switchroot/ostree-prepare-root.c
@@ -60,7 +60,9 @@ resolve_deploy_path (const char * root_mountpoint)
     errx (EXIT_FAILURE, "No OSTree target; expected ostree=/ostree/boot.N/...");
   snprintf (destpath, sizeof(destpath), "%s/%s", root_mountpoint, ostree_target);
-  printf ("Examining %s\n", destpath);
+  /* In systemd case this goes to the journal, but be silent if we're init */
+  if (getpid() != 1)
+    printf ("Examining %s\n", destpath);
   if (lstat (destpath, &stbuf) < 0)
     err (EXIT_FAILURE, "Couldn't find specified OSTree root '%s'", destpath);
   if (!S_ISLNK (stbuf.st_mode))
@@ -68,7 +70,8 @@ resolve_deploy_path (const char * root_mountpoint)
   deploy_path = realpath (destpath, NULL);
   if (deploy_path == NULL)
     err (EXIT_FAILURE, "realpath(%s) failed", destpath);
-  printf ("Resolved OSTree target to: %s\n", deploy_path);
+  if (getpid() != 1)
+    printf ("Resolved OSTree target to: %s\n", deploy_path);
   return deploy_path;

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]