X Tutup
Skip to content

Commit b1c4ca2

Browse files
committed
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.
1 parent 46a2911 commit b1c4ca2

File tree

9 files changed

+46
-85
lines changed

9 files changed

+46
-85
lines changed

Makefile.am

Lines changed: 9 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -406,34 +406,15 @@ EXTRA_DIST += \
406406
units/systemd-modules-load.service.in
407407
endif
408408

409-
if TARGET_FEDORA
410-
dist_systemunit_DATA += \
411-
units/fedora/rc-local.service \
412-
units/fedora/halt-local.service
413-
systemgenerator_PROGRAMS += \
414-
systemd-rc-local-generator
415-
endif
416-
417-
if TARGET_MANDRIVA
418-
dist_systemunit_DATA += \
419-
units/fedora/rc-local.service \
420-
units/fedora/halt-local.service
421-
systemgenerator_PROGRAMS += \
422-
systemd-rc-local-generator
423-
endif
409+
if HAVE_SYSV_COMPAT
410+
nodist_systemunit_DATA += \
411+
units/rc-local.service \
412+
units/halt-local.service
424413

425-
if TARGET_SUSE
426-
dist_systemunit_DATA += \
427-
units/suse/rc-local.service \
428-
units/suse/halt-local.service
429-
systemgenerator_PROGRAMS += \
430-
systemd-rc-local-generator
431-
endif
414+
EXTRA_DIST += \
415+
units/rc-local.service.in \
416+
units/halt-local.service.in
432417

433-
if TARGET_MAGEIA
434-
dist_systemunit_DATA += \
435-
units/fedora/rc-local.service \
436-
units/fedora/halt-local.service
437418
systemgenerator_PROGRAMS += \
438419
systemd-rc-local-generator
439420
endif
@@ -3856,6 +3837,8 @@ SED_PROCESS = \
38563837
-e 's,@QUOTACHECK\@,$(QUOTACHECK),g' \
38573838
-e 's,@SYSTEM_SYSVINIT_PATH\@,$(sysvinitdir),g' \
38583839
-e 's,@VARLOGDIR\@,$(varlogdir),g' \
3840+
-e 's,@RC_LOCAL_SCRIPT_PATH_START\@,$(RC_LOCAL_SCRIPT_PATH_START),g' \
3841+
-e 's,@RC_LOCAL_SCRIPT_PATH_STOP\@,$(RC_LOCAL_SCRIPT_PATH_STOP),g' \
38593842
< $< > $@
38603843

38613844
units/%: units/%.in Makefile
@@ -4133,12 +4116,6 @@ if TARGET_MANDRIVA
41334116
$(LN_S) rescue.service single.service )
41344117
endif
41354118

4136-
if TARGET_SUSE
4137-
( cd $(DESTDIR)$(systemunitdir) && \
4138-
rm -f local.service && \
4139-
$(LN_S) rc-local.service local.service )
4140-
endif
4141-
41424119
if TARGET_MAGEIA
41434120
( cd $(DESTDIR)$(systemunitdir) && \
41444121
rm -f display-manager.service )

configure.ac

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -588,6 +588,25 @@ if test "x$enable_coredump" != "xno"; then
588588
fi
589589
AM_CONDITIONAL(ENABLE_COREDUMP, [test "$have_coredump" = "yes"])
590590

591+
# ------------------------------------------------------------------------------
592+
AC_ARG_WITH(rc-local-script-path-start,
593+
AS_HELP_STRING([--with-rc-local-script-path-start=PATH],
594+
[Path to /etc/rc.local]),
595+
[RC_LOCAL_SCRIPT_PATH_START="$withval"],
596+
[RC_LOCAL_SCRIPT_PATH_START="/etc/rc.local"])
597+
598+
AC_ARG_WITH(rc-local-script-path-stop,
599+
AS_HELP_STRING([--with-rc-local-script-path-stop=PATH],
600+
[Path to /sbin/halt.local]),
601+
[RC_LOCAL_SCRIPT_PATH_STOP="$withval"],
602+
[RC_LOCAL_SCRIPT_PATH_STOP="/sbin/halt.local"])
603+
604+
AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_START, ["$RC_LOCAL_SCRIPT_PATH_START"], [Path of /etc/rc.local script])
605+
AC_DEFINE_UNQUOTED(RC_LOCAL_SCRIPT_PATH_STOP, ["$RC_LOCAL_SCRIPT_PATH_STOP"], [Path of /sbin/halt.local script])
606+
607+
AC_SUBST(RC_LOCAL_SCRIPT_PATH_START)
608+
AC_SUBST(RC_LOCAL_SCRIPT_PATH_STOP)
609+
591610
# ------------------------------------------------------------------------------
592611
AC_ARG_WITH(firmware-path,
593612
AS_HELP_STRING([--with-firmware-path=DIR[[[:DIR[...]]]]],
@@ -889,6 +908,8 @@ AC_MSG_RESULT([
889908
Split /usr: ${enable_split_usr}
890909
man pages: ${have_manpages}
891910
gtk-doc: ${enable_gtk_doc}
911+
Extra start script: ${RC_LOCAL_SCRIPT_PATH_START}
912+
Extra stop script: ${RC_LOCAL_SCRIPT_PATH_STOP}
892913
893914
CFLAGS: ${OUR_CFLAGS} ${CFLAGS}
894915
CPPLAGS: ${OUR_CPPFLAGS} ${CPPFLAGS}

src/rc-local-generator/rc-local-generator.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@
2828
#include "util.h"
2929
#include "mkdir.h"
3030

31-
#if defined(TARGET_FEDORA) || defined(TARGET_MANDRIVA) || defined(TARGET_MAGEIA)
32-
#define SCRIPT_PATH_START "/etc/rc.d/rc.local"
33-
#elif defined(TARGET_SUSE)
34-
#define SCRIPT_PATH_START "/etc/init.d/boot.local"
31+
#ifndef RC_LOCAL_SCRIPT_PATH_START
32+
#define RC_LOCAL_SCRIPT_PATH_START "/etc/rc.d/rc.local"
3533
#endif
3634

37-
#define SCRIPT_PATH_STOP "/sbin/halt.local"
35+
#ifndef RC_LOCAL_SCRIPT_PATH_STOP
36+
#define RC_LOCAL_SCRIPT_PATH_STOP "/sbin/halt.local"
37+
#endif
3838

3939
const char *arg_dest = "/tmp";
4040

@@ -97,14 +97,14 @@ int main(int argc, char *argv[]) {
9797

9898
umask(0022);
9999

100-
if (file_is_executable(SCRIPT_PATH_START)) {
100+
if (file_is_executable(RC_LOCAL_SCRIPT_PATH_START)) {
101101
log_debug("Automatically adding rc-local.service.");
102102

103103
if (add_symlink("rc-local.service", "multi-user.target") < 0)
104104
r = EXIT_FAILURE;
105105
}
106106

107-
if (file_is_executable(SCRIPT_PATH_STOP)) {
107+
if (file_is_executable(RC_LOCAL_SCRIPT_PATH_STOP)) {
108108
log_debug("Automatically adding halt-local.service.");
109109

110110
if (add_symlink("halt-local.service", "final.target") < 0)

units/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
/halt-local.service
2+
/rc-local.service
13
/systemd-hybrid-sleep.service
24
/systemd-journal-gatewayd.service
35
/systemd-journal-flush.service

units/fedora/Makefile

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
# (at your option) any later version.
77

88
[Unit]
9-
Description=/sbin/halt.local Compatibility
10-
ConditionFileIsExecutable=/sbin/halt.local
9+
Description=@RC_LOCAL_SCRIPT_PATH_STOP@ Compatibility
10+
ConditionFileIsExecutable=@RC_LOCAL_SCRIPT_PATH_STOP@
1111
DefaultDependencies=no
1212
After=shutdown.target
1313
Before=final.target
1414

1515
[Service]
1616
Type=oneshot
17-
ExecStart=/sbin/halt.local
17+
ExecStart=@RC_LOCAL_SCRIPT_PATH_STOP@
1818
TimeoutSec=0
1919
StandardOutput=tty
2020
RemainAfterExit=yes
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
# (at your option) any later version.
77

88
# This unit gets pulled automatically into multi-user.target by
9-
# systemd-rc-local-generator if /etc/rc.d/rc.local is executable.
9+
# systemd-rc-local-generator if @RC_LOCAL_SCRIPT_PATH_START@ is executable.
1010
[Unit]
11-
Description=/etc/rc.d/rc.local Compatibility
11+
Description=@RC_LOCAL_SCRIPT_PATH_START@ Compatibility
12+
ConditionFileIsExecutable=@RC_LOCAL_SCRIPT_PATH_START@
1213
After=network.target
1314

1415
[Service]
1516
Type=forking
16-
ExecStart=/etc/rc.d/rc.local start
17+
ExecStart=@RC_LOCAL_SCRIPT_PATH_START@ start
1718
TimeoutSec=0
1819
RemainAfterExit=yes
1920
SysVStartPriority=99

units/suse/halt-local.service

Lines changed: 0 additions & 20 deletions
This file was deleted.

units/suse/rc-local.service

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)
X Tutup