tmpfiles: Remove unnecessary utmp file creation (#6006)
authorcodekipper <codekipper@gmail.com>
Wed, 24 May 2017 09:10:59 +0000 (11:10 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 24 May 2017 09:10:59 +0000 (11:10 +0200)
If utmp is disabled (--disable-utmp) then there is no need to create
the wtmp and btmp files.

Makefile.am
configure.ac
tmpfiles.d/meson.build
tmpfiles.d/var.conf [deleted file]
tmpfiles.d/var.conf.m4 [new file with mode: 0644]

index 6b418dc7b163dce590a20dd1275f027f6aac2d21..1cbb278c68eae5949f9892feb0329a5890f213ec 100644 (file)
@@ -2675,13 +2675,13 @@ nodist_systemunit_DATA += \
 
 nodist_tmpfiles_DATA = \
        tmpfiles.d/systemd.conf \
+       tmpfiles.d/var.conf \
        tmpfiles.d/etc.conf
 
 dist_tmpfiles_DATA = \
        tmpfiles.d/systemd-nologin.conf \
        tmpfiles.d/tmp.conf \
        tmpfiles.d/x11.conf \
-       tmpfiles.d/var.conf \
        tmpfiles.d/home.conf \
        tmpfiles.d/systemd-nspawn.conf \
        tmpfiles.d/journal-nocow.conf
@@ -2709,6 +2709,7 @@ endif
 EXTRA_DIST += \
        tmpfiles.d/systemd.conf.m4 \
        tmpfiles.d/etc.conf.m4 \
+       tmpfiles.d/var.conf.m4 \
        units/systemd-tmpfiles-setup-dev.service.in \
        units/systemd-tmpfiles-setup.service.in \
        units/systemd-tmpfiles-clean.service.in
index c8c162b6989e1db4d70025dbd15bc104254f00f0..a47492df3e9b6cd6a62e2af5f506a84e7d258f42 100644 (file)
@@ -422,7 +422,11 @@ AC_ARG_ENABLE([utmp], AS_HELP_STRING([--disable-utmp], [disable utmp/wtmp log ha
                 [xyes], [have_utmp=yes],
                 [xno],  [have_utmp=no],
                 AC_MSG_ERROR(bad value ${enableval} for --enable-utmp)))
-AS_IF([test "x$have_utmp" = "xyes"], [AC_DEFINE(HAVE_UTMP, 1, [Define if utmp/wtmp support is enabled])])
+AS_IF([test "x$have_utmp" = "xyes"], [
+        AC_DEFINE(HAVE_UTMP, 1, [Define if utmp/wtmp support is enabled])
+        have_utmp=yes
+        M4_DEFINES="$M4_DEFINES -DHAVE_UTMP"],
+        [have_utmp=no])
 AM_CONDITIONAL([HAVE_UTMP], [test "x$have_utmp" = "xyes"])
 
 # ------------------------------------------------------------------------------
index d68d17e956f52dda499256dcfe0b1d1a22d230bc..da87ea505695af9df818771ef70c2851809daeda 100644 (file)
@@ -6,7 +6,6 @@ tmpfiles = [['home.conf',            ''],
             ['systemd-nspawn.conf',  ''],
             ['systemd-remote.conf',  'ENABLE_REMOTE'],
             ['tmp.conf',             ''],
-            ['var.conf',             ''],
             ['x11.conf',             ''],
             ['legacy.conf',          'HAVE_SYSV_COMPAT'],
            ]
@@ -23,7 +22,8 @@ foreach pair : tmpfiles
 endforeach
 
 m4_files = ['etc.conf',
-            'systemd.conf']
+            'systemd.conf',
+            'var.conf']
 
 foreach file : m4_files
         custom_target(
diff --git a/tmpfiles.d/var.conf b/tmpfiles.d/var.conf
deleted file mode 100644 (file)
index ae7952e..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#  This file is part of systemd.
-#
-#  systemd is free software; you can redistribute it and/or modify it
-#  under the terms of the GNU Lesser General Public License as published by
-#  the Free Software Foundation; either version 2.1 of the License, or
-#  (at your option) any later version.
-
-# See tmpfiles.d(5) for details
-
-q /var 0755 - - -
-
-L /var/run - - - - ../run
-
-d /var/log 0755 - - -
-f /var/log/wtmp 0664 root utmp -
-f /var/log/btmp 0600 root utmp -
-
-d /var/cache 0755 - - -
-
-d /var/lib 0755 - - -
-
-d /var/spool 0755 - - -
diff --git a/tmpfiles.d/var.conf.m4 b/tmpfiles.d/var.conf.m4
new file mode 100644 (file)
index 0000000..24374ba
--- /dev/null
@@ -0,0 +1,24 @@
+#  This file is part of systemd.
+#
+#  systemd is free software; you can redistribute it and/or modify it
+#  under the terms of the GNU Lesser General Public License as published by
+#  the Free Software Foundation; either version 2.1 of the License, or
+#  (at your option) any later version.
+
+# See tmpfiles.d(5) for details
+
+q /var 0755 - - -
+
+L /var/run - - - - ../run
+
+d /var/log 0755 - - -
+m4_ifdef(`HAVE_UTMP',
+f /var/log/wtmp 0664 root utmp -
+f /var/log/btmp 0600 root utmp -
+)m4_dnl
+
+d /var/cache 0755 - - -
+
+d /var/lib 0755 - - -
+
+d /var/spool 0755 - - -