chiark / gitweb /
build-sys: make rc-local support part of SYSV compat
authorLennart Poettering <lennart@poettering.net>
Fri, 4 Jan 2013 20:48:47 +0000 (21:48 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 4 Jan 2013 22:26:20 +0000 (23:26 +0100)
This also drops automatic selection of the rc local scripts
based on the local distro. Distributions now should specify the paths
of the rc-local and halt-local scripts on the configure command line.

Makefile.am
configure.ac
src/rc-local-generator/rc-local-generator.c
units/.gitignore
units/fedora/Makefile [deleted symlink]
units/halt-local.service.in [moved from units/fedora/halt-local.service with 75% similarity]
units/rc-local.service.in [moved from units/fedora/rc-local.service with 66% similarity]
units/suse/halt-local.service [deleted file]
units/suse/rc-local.service [deleted file]

index 94ae549b8f90ed15c077b124ab025a6684889189..9132ccdfc30ae01b140a8b745782f37feef3b0a2 100644 (file)
@@ -406,34 +406,15 @@ EXTRA_DIST += \
        units/systemd-modules-load.service.in
 endif
 
-if TARGET_FEDORA
-dist_systemunit_DATA += \
-       units/fedora/rc-local.service \
-       units/fedora/halt-local.service
-systemgenerator_PROGRAMS += \
-       systemd-rc-local-generator
-endif
-
-if TARGET_MANDRIVA
-dist_systemunit_DATA += \
-       units/fedora/rc-local.service \
-       units/fedora/halt-local.service
-systemgenerator_PROGRAMS += \
-       systemd-rc-local-generator
-endif
+if HAVE_SYSV_COMPAT
+nodist_systemunit_DATA += \
+       units/rc-local.service \
+       units/halt-local.service
 
-if TARGET_SUSE
-dist_systemunit_DATA += \
-       units/suse/rc-local.service \
-       units/suse/halt-local.service
-systemgenerator_PROGRAMS += \
-       systemd-rc-local-generator
-endif
+EXTRA_DIST += \
+       units/rc-local.service.in \
+       units/halt-local.service.in
 
-if TARGET_MAGEIA
-dist_systemunit_DATA += \
-       units/fedora/rc-local.service \
-       units/fedora/halt-local.service
 systemgenerator_PROGRAMS += \
        systemd-rc-local-generator
 endif
@@ -3856,6 +3837,8 @@ SED_PROCESS = \
                -e 's,@QUOTACHECK\@,$(QUOTACHECK),g' \
                -e 's,@SYSTEM_SYSVINIT_PATH\@,$(sysvinitdir),g' \
                -e 's,@VARLOGDIR\@,$(varlogdir),g' \
+               -e 's,@RC_LOCAL_SCRIPT_PATH_START\@,$(RC_LOCAL_SCRIPT_PATH_START),g' \
+               -e 's,@RC_LOCAL_SCRIPT_PATH_STOP\@,$(RC_LOCAL_SCRIPT_PATH_STOP),g' \
                < $< > $@
 
 units/%: units/%.in Makefile
@@ -4133,12 +4116,6 @@ if TARGET_MANDRIVA
                $(LN_S) rescue.service single.service )
 endif
 
-if TARGET_SUSE
-       ( cd $(DESTDIR)$(systemunitdir) && \
-               rm -f local.service && \
-               $(LN_S) rc-local.service local.service )
-endif
-
 if TARGET_MAGEIA
        ( cd $(DESTDIR)$(systemunitdir) && \
                rm -f display-manager.service )
index d0003bb5bd7d3eef96bc3a056faf1dc1df5d9ffa..92dbdf5a30552e2edda3e5b8dd2408663c46c242 100644 (file)
@@ -588,6 +588,25 @@ if test "x$enable_coredump" != "xno"; then
 fi
 AM_CONDITIONAL(ENABLE_COREDUMP, [test "$have_coredump" = "yes"])
 
+# ------------------------------------------------------------------------------
+AC_ARG_WITH(rc-local-script-path-start,
+        AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
+                [Path to /etc/rc.local]),
+        [RC_LOCAL_SCRIPT_PATH_START="$withval"],
+        [RC_LOCAL_SCRIPT_PATH_START="/etc/rc.local"])
+
+AC_ARG_WITH(rc-local-script-path-stop,
+        AS_HELP_STRING([--with-rc-local-script-path-stop=PATH],
+                [Path to /sbin/halt.local]),
+        [RC_LOCAL_SCRIPT_PATH_STOP="$withval"],
+        [RC_LOCAL_SCRIPT_PATH_STOP="/sbin/halt.local"])
+
+AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_START, ["$RC_LOCAL_SCRIPT_PATH_START"], [Path of /etc/rc.local script])
+AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_STOP, ["$RC_LOCAL_SCRIPT_PATH_STOP"], [Path of /sbin/halt.local script])
+
+AC_SUBST(RC_LOCAL_SCRIPT_PATH_START)
+AC_SUBST(RC_LOCAL_SCRIPT_PATH_STOP)
+
 # ------------------------------------------------------------------------------
 AC_ARG_WITH(firmware-path,
        AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
@@ -889,6 +908,8 @@ AC_MSG_RESULT([
         Split /usr:              ${enable_split_usr}
         man pages:               ${have_manpages}
         gtk-doc:                 ${enable_gtk_doc}
+        Extra start script:      ${RC_LOCAL_SCRIPT_PATH_START}
+        Extra stop script:       ${RC_LOCAL_SCRIPT_PATH_STOP}
 
         CFLAGS:                  ${OUR_CFLAGS} ${CFLAGS}
         CPPLAGS:                 ${OUR_CPPFLAGS} ${CPPFLAGS}
index c219e770470454215129a9bdcf96e5ac6d70f33a..448980ba2da7f2a8da701bac5279ec29d9b6648e 100644 (file)
 #include "util.h"
 #include "mkdir.h"
 
-#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
-#define SCRIPT_PATH_START "/etc/rc.d/rc.local"
-#elif defined(TARGET_SUSE)
-#define SCRIPT_PATH_START "/etc/init.d/boot.local"
+#ifndef RC_LOCAL_SCRIPT_PATH_START
+#define RC_LOCAL_SCRIPT_PATH_START "/etc/rc.d/rc.local"
 #endif
 
-#define SCRIPT_PATH_STOP "/sbin/halt.local"
+#ifndef RC_LOCAL_SCRIPT_PATH_STOP
+#define RC_LOCAL_SCRIPT_PATH_STOP "/sbin/halt.local"
+#endif
 
 const char *arg_dest = "/tmp";
 
@@ -97,14 +97,14 @@ int main(int argc, char *argv[]) {
 
         umask(0022);
 
-        if (file_is_executable(SCRIPT_PATH_START)) {
+        if (file_is_executable(RC_LOCAL_SCRIPT_PATH_START)) {
                 log_debug("Automatically adding rc-local.service.");
 
                 if (add_symlink("rc-local.service", "multi-user.target") < 0)
                         r = EXIT_FAILURE;
         }
 
-        if (file_is_executable(SCRIPT_PATH_STOP)) {
+        if (file_is_executable(RC_LOCAL_SCRIPT_PATH_STOP)) {
                 log_debug("Automatically adding halt-local.service.");
 
                 if (add_symlink("halt-local.service", "final.target") < 0)
index 63c7ba06bba59a1d891eca77eafb2ff4ab5c1e0b..5e86d30113e1d896455c3c058c75aed1865b699e 100644 (file)
@@ -1,3 +1,5 @@
+/halt-local.service
+/rc-local.service
 /systemd-hybrid-sleep.service
 /systemd-journal-gatewayd.service
 /systemd-journal-flush.service
diff --git a/units/fedora/Makefile b/units/fedora/Makefile
deleted file mode 120000 (symlink)
index 50be211..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../../src/Makefile
\ No newline at end of file
similarity index 75%
rename from units/fedora/halt-local.service
rename to units/halt-local.service.in
index a0a3a292e7ccd87ba33ce800179e92fe9587c2eb..c8be8965a3e978f5cffcded5f2e9997457ba189e 100644 (file)
@@ -6,15 +6,15 @@
 #  (at your option) any later version.
 
 [Unit]
-Description=/sbin/halt.local Compatibility
-ConditionFileIsExecutable=/sbin/halt.local
+Description=@RC_LOCAL_SCRIPT_PATH_STOP@ Compatibility
+ConditionFileIsExecutable=@RC_LOCAL_SCRIPT_PATH_STOP@
 DefaultDependencies=no
 After=shutdown.target
 Before=final.target
 
 [Service]
 Type=oneshot
-ExecStart=/sbin/halt.local
+ExecStart=@RC_LOCAL_SCRIPT_PATH_STOP@
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes
similarity index 66%
rename from units/fedora/rc-local.service
rename to units/rc-local.service.in
index 3b3bda9f6f32f083d6613dfbb2c790f3049679f1..97d44a7a27aebe8d074825db8fc458d8e8e79b16 100644 (file)
@@ -6,14 +6,15 @@
 #  (at your option) any later version.
 
 # This unit gets pulled automatically into multi-user.target by
-# systemd-rc-local-generator if /etc/rc.d/rc.local is executable.
+# systemd-rc-local-generator if @RC_LOCAL_SCRIPT_PATH_START@ is executable.
 [Unit]
-Description=/etc/rc.d/rc.local Compatibility
+Description=@RC_LOCAL_SCRIPT_PATH_START@ Compatibility
+ConditionFileIsExecutable=@RC_LOCAL_SCRIPT_PATH_START@
 After=network.target
 
 [Service]
 Type=forking
-ExecStart=/etc/rc.d/rc.local start
+ExecStart=@RC_LOCAL_SCRIPT_PATH_START@ start
 TimeoutSec=0
 RemainAfterExit=yes
 SysVStartPriority=99
diff --git a/units/suse/halt-local.service b/units/suse/halt-local.service
deleted file mode 100644 (file)
index 3a3a793..0000000
+++ /dev/null
@@ -1,20 +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.
-
-[Unit]
-Description=/etc/init.d/halt.local Compatibility
-ConditionFileIsExecutable=/etc/init.d/halt.local
-DefaultDependencies=no
-After=shutdown.target
-Before=final.target
-
-[Service]
-Type=oneshot
-ExecStart=/etc/init.d/halt.local
-TimeoutSec=0
-StandardOutput=tty
-RemainAfterExit=yes
diff --git a/units/suse/rc-local.service b/units/suse/rc-local.service
deleted file mode 100644 (file)
index 0fd70e0..0000000
+++ /dev/null
@@ -1,19 +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.
-
-# This unit gets pulled automatically into multi-user.target by
-# systemd-rc-local-generator if /etc/init.d/boot.local is executable.
-[Unit]
-Description=/etc/init.d/boot.local Compatibility
-After=network.target
-
-[Service]
-Type=oneshot
-ExecStart=/etc/init.d/boot.local
-TimeoutSec=0
-RemainAfterExit=yes
-SysVStartPriority=99