[systemd-commits] 2 commits - Makefile.am README configure.ac src/core src/shared

Lennart Poettering lennart at kemper.freedesktop.org
Wed Feb 13 14:08:42 PST 2013


 Makefile.am                     |   23 ++++++++++++++++++-----
 README                          |    1 +
 configure.ac                    |   20 ++++++++++++++++++++
 src/core/manager.c              |    2 ++
 src/core/mount-setup.c          |    2 ++
 src/shared/efivars.c            |    4 ++++
 src/shared/polkit.c             |   10 +++++++++-
 src/shared/spawn-polkit-agent.c |   12 ++++++++++++
 8 files changed, 68 insertions(+), 6 deletions(-)

New commits:
commit b872e9a05939bc3e0ac95a042592506a7488dd6f
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 13 23:07:59 2013 +0100

    build-sys: make EFI support build-time optional

diff --git a/Makefile.am b/Makefile.am
index d73b78c..65294a5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -295,8 +295,7 @@ rootlibexec_PROGRAMS = \
 systemgenerator_PROGRAMS = \
 	systemd-getty-generator \
 	systemd-fstab-generator \
-	systemd-system-update-generator \
-	systemd-efi-boot-generator
+	systemd-system-update-generator
 
 dist_bin_SCRIPTS = \
 	src/analyze/systemd-analyze
@@ -1002,8 +1001,7 @@ noinst_PROGRAMS += \
 	test-cgroup \
 	test-install \
 	test-watchdog \
-	test-log \
-	test-efivars
+	test-log
 
 noinst_tests += \
 	test-job-type \
@@ -1071,11 +1069,16 @@ test_hostname_SOURCES = \
 test_hostname_LDADD = \
 	libsystemd-core.la
 
+if ENABLE_EFI
+noinst_PROGRAMS += \
+	test-efivars
+
 test_efivars_SOURCES = \
 	src/test/test-efivars.c
 
 test_efivars_LDADD = \
 	libsystemd-shared.la
+endif
 
 test_unit_name_SOURCES = \
 	src/test/test-unit-name.c
@@ -1410,12 +1413,17 @@ systemd_system_update_generator_LDADD = \
 	libsystemd-shared.la
 
 # ------------------------------------------------------------------------------
+if ENABLE_EFI
+systemgenerator_PROGRAMS +=  \
+	systemd-efi-boot-generator
+
 systemd_efi_boot_generator_SOURCES = \
 	src/efi-boot-generator/efi-boot-generator.c
 
 systemd_efi_boot_generator_LDADD = \
 	libsystemd-label.la \
 	libsystemd-shared.la
+endif
 
 # ------------------------------------------------------------------------------
 systemd_rc_local_generator_SOURCES = \
@@ -3079,6 +3087,7 @@ EXTRA_DIST += \
 	units/systemd-timedated.service.in
 
 # ------------------------------------------------------------------------------
+if ENABLE_EFI
 bootctl_SOURCES = \
 	src/boot/boot.h \
 	src/boot/boot-loader.h \
@@ -3093,6 +3102,7 @@ bootctl_LDADD = \
 
 bin_PROGRAMS += \
 	bootctl
+endif
 
 # ------------------------------------------------------------------------------
 if HAVE_MYHOSTNAME
diff --git a/configure.ac b/configure.ac
index 228f696..834b123 100644
--- a/configure.ac
+++ b/configure.ac
@@ -636,6 +636,15 @@ fi
 AM_CONDITIONAL(ENABLE_POLKIT, [test "x$have_polkit" = "xyes"])
 
 # ------------------------------------------------------------------------------
+have_efi=no
+AC_ARG_ENABLE(efi, AS_HELP_STRING([--disable-efi], [disable EFI support]))
+if test "x$enable_efi" != "xno"; then
+        AC_DEFINE(ENABLE_EFI, 1, [Define if EFI support is to be enabled])
+        have_efi=yes
+fi
+AM_CONDITIONAL(ENABLE_EFI, [test "x$have_efi" = "xyes"])
+
+# ------------------------------------------------------------------------------
 AC_ARG_WITH(rc-local-script-path-start,
         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
                 [Path to /etc/rc.local]),
@@ -882,6 +891,7 @@ AC_MSG_RESULT([
         localed:                 ${have_localed}
         coredump:                ${have_coredump}
         polkit:                  ${have_polkit}
+        efi:                     ${have_efi}
         kmod:                    ${have_kmod}
         blkid:                   ${have_blkid}
         nss-myhostname:          ${have_myhostname}
diff --git a/src/core/manager.c b/src/core/manager.c
index bd49892..28f169d 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -309,7 +309,9 @@ int manager_new(SystemdRunningAs running_as, Manager **_m) {
 
         dual_timestamp_get(&m->userspace_timestamp);
         dual_timestamp_from_monotonic(&m->kernel_timestamp, 0);
+#ifdef ENABLE_EFI
         efi_get_boot_timestamps(&m->userspace_timestamp, &m->firmware_timestamp, &m->loader_timestamp);
+#endif
 
         m->running_as = running_as;
         m->name_data_slot = m->conn_data_slot = m->subscribed_data_slot = -1;
diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c
index 2cd0b60..e7e2736 100644
--- a/src/core/mount-setup.c
+++ b/src/core/mount-setup.c
@@ -77,8 +77,10 @@ static const MountPoint mount_table[] = {
           NULL,       MNT_FATAL|MNT_IN_CONTAINER },
         { "securityfs", "/sys/kernel/security",      "securityfs", NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
           NULL,       MNT_NONE },
+#ifdef ENABLE_EFI
         { "efivarfs",   "/sys/firmware/efi/efivars", "efivarfs",   NULL, MS_NOSUID|MS_NOEXEC|MS_NODEV,
           is_efi_boot, MNT_NONE },
+#endif
         { "tmpfs",      "/dev/shm",                  "tmpfs",      "mode=1777", MS_NOSUID|MS_NODEV|MS_STRICTATIME,
           NULL,       MNT_FATAL|MNT_IN_CONTAINER },
         { "devpts",     "/dev/pts",                  "devpts",     "mode=620,gid=" STRINGIFY(TTY_GID), MS_NOSUID|MS_NOEXEC,
diff --git a/src/shared/efivars.c b/src/shared/efivars.c
index 840e4e0..8494f37 100644
--- a/src/shared/efivars.c
+++ b/src/shared/efivars.c
@@ -28,6 +28,8 @@
 #include "utf8.h"
 #include "efivars.h"
 
+#ifdef ENABLE_EFI
+
 bool is_efi_boot(void) {
         return access("/sys/firmware/efi", F_OK) >= 0;
 }
@@ -469,3 +471,5 @@ int efi_get_loader_device_part_uuid(sd_id128_t *u) {
 
         return 0;
 }
+
+#endif

commit 46ba8aae2b82bc5c87ba347e6bf914ecd5e9d51e
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Feb 13 22:56:43 2013 +0100

    build-sys: make PolicyKit support compile-time optional (was runtime-optional already)

diff --git a/Makefile.am b/Makefile.am
index aae3c27..d73b78c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -109,6 +109,7 @@ noinst_LTLIBRARIES =
 lib_LTLIBRARIES =
 include_HEADERS =
 pkgconfiglib_DATA =
+polkitpolicy_in_in_files =
 polkitpolicy_in_files =
 polkitpolicy_files =
 dist_udevrules_DATA =
@@ -969,7 +970,7 @@ dbusinterface_DATA += \
 	org.freedesktop.systemd1.Swap.xml \
 	org.freedesktop.systemd1.Path.xml
 
-polkitpolicy_in_in_files = \
+polkitpolicy_in_in_files += \
 	src/core/org.freedesktop.systemd1.policy.in.in
 
 org.freedesktop.systemd1.%.xml: systemd
@@ -3474,9 +3475,11 @@ units/user/%: units/%.m4 Makefile
 	$(AM_V_M4)$(MKDIR_P) $(dir $@)
 	$(AM_V_M4)$(M4) -P $(M4_DEFINES) -DFOR_USER=1 < $< > $@
 
+if ENABLE_POLKIT
 nodist_polkitpolicy_DATA = \
 	$(polkitpolicy_files) \
 	$(polkitpolicy_in_in_files:.policy.in.in=.policy)
+endif
 
 EXTRA_DIST += \
 	$(polkitpolicy_in_files) \
diff --git a/README b/README
index 3b24804..f20bd38 100644
--- a/README
+++ b/README
@@ -61,6 +61,7 @@ REQUIREMENTS:
         util-linux >= v2.19 (requires fsck -l, agetty -s)
         sulogin (from util-linux >= 2.22 or sysvinit-tools, optional but recommended)
         dracut (optional)
+        PolicyKit (optional)
 
         When building from git you need the following additional dependencies:
 
diff --git a/configure.ac b/configure.ac
index 4e36dc3..228f696 100644
--- a/configure.ac
+++ b/configure.ac
@@ -627,6 +627,15 @@ fi
 AM_CONDITIONAL(ENABLE_COREDUMP, [test "$have_coredump" = "yes"])
 
 # ------------------------------------------------------------------------------
+have_polkit=no
+AC_ARG_ENABLE(polkit, AS_HELP_STRING([--disable-polkit], [disable PolicyKit support]))
+if test "x$enable_polkit" != "xno"; then
+        AC_DEFINE(ENABLE_POLKIT, 1, [Define if PolicyKit support is to be enabled])
+        have_polkit=yes
+fi
+AM_CONDITIONAL(ENABLE_POLKIT, [test "x$have_polkit" = "xyes"])
+
+# ------------------------------------------------------------------------------
 AC_ARG_WITH(rc-local-script-path-start,
         AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
                 [Path to /etc/rc.local]),
@@ -872,6 +881,7 @@ AC_MSG_RESULT([
         timedated:               ${have_timedated}
         localed:                 ${have_localed}
         coredump:                ${have_coredump}
+        polkit:                  ${have_polkit}
         kmod:                    ${have_kmod}
         blkid:                   ${have_blkid}
         nss-myhostname:          ${have_myhostname}
diff --git a/src/shared/polkit.c b/src/shared/polkit.c
index 8269445..cea7074 100644
--- a/src/shared/polkit.c
+++ b/src/shared/polkit.c
@@ -35,9 +35,10 @@ int verify_polkit(
                 bool *_challenge,
                 DBusError *error) {
 
+
+#ifdef ENABLE_POLKIT
         DBusMessage *m = NULL, *reply = NULL;
         const char *unix_process = "unix-process", *pid = "pid", *starttime = "start-time", *cancel_id = "";
-        const char *sender;
         uint32_t flags = interactive ? 1 : 0;
         pid_t pid_raw;
         uint32_t pid_u32;
@@ -46,6 +47,8 @@ int verify_polkit(
         DBusMessageIter iter_msg, iter_struct, iter_array, iter_dict, iter_variant;
         int r;
         dbus_bool_t authorized = FALSE, challenge = FALSE;
+#endif
+        const char *sender;
         unsigned long ul;
 
         assert(c);
@@ -63,6 +66,8 @@ int verify_polkit(
         if (ul == 0)
                 return 1;
 
+#ifdef ENABLE_POLKIT
+
         pid_raw = bus_get_unix_process_id(c, sender, error);
         if (pid_raw == 0)
                 return -EINVAL;
@@ -163,4 +168,7 @@ finish:
                 dbus_message_unref(reply);
 
         return r;
+#else
+        return -EPERM;
+#endif
 }
diff --git a/src/shared/spawn-polkit-agent.c b/src/shared/spawn-polkit-agent.c
index fcb3722..f9e52cd 100644
--- a/src/shared/spawn-polkit-agent.c
+++ b/src/shared/spawn-polkit-agent.c
@@ -33,6 +33,7 @@
 #include "util.h"
 #include "spawn-polkit-agent.h"
 
+#ifdef ENABLE_POLKIT
 static pid_t agent_pid = 0;
 
 int polkit_agent_open(void) {
@@ -84,3 +85,14 @@ void polkit_agent_close(void) {
         wait_for_terminate(agent_pid, NULL);
         agent_pid = 0;
 }
+
+#else
+
+int polkit_agent_open(void) {
+        return 0;
+}
+
+void polkit_agent_close(void) {
+}
+
+#endif



More information about the systemd-commits mailing list