Commit b1c4ca25 authored by Lennart Poettering's avatar Lennart Poettering
Browse files

build-sys: make rc-local support part of SYSV compat

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.
parent 46a2911b
......@@ -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 )
......
......@@ -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}
......
......@@ -28,13 +28,13 @@
#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)
......
/halt-local.service
/rc-local.service
/systemd-hybrid-sleep.service
/systemd-journal-gatewayd.service
/systemd-journal-flush.service
......
../../src/Makefile
\ No newline at end of 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
......@@ -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
# 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
# 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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment