From: Stefan Schantl Date: Tue, 1 Nov 2011 12:17:01 +0000 (+0100) Subject: initscripts: Add /etc/rc.local. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a011e61c7e92a77dc6ed0df00bd3ae3dcd116a7;p=ipfire-3.x.git initscripts: Add /etc/rc.local. This file allows own instructions and will be executed at the end of the boot process. Fixes #273 --- diff --git a/initscripts/initscripts.nm b/initscripts/initscripts.nm index ad1141ec7..08850f82f 100644 --- a/initscripts/initscripts.nm +++ b/initscripts/initscripts.nm @@ -6,7 +6,7 @@ name = initscripts epoch = 1 version = 2.99 -release = 10 +release = 11 groups = Base System/Boot url = @@ -44,6 +44,9 @@ build install cd src && make install clean DESTDIR=%{BUILDROOT} + # Install rc.local + install -v -m 755 %{DIR_SOURCE}/rc.local %{BUILDROT}/etc/rc.local + # Install udev rules mkdir -pv %{BUILDROOT}/lib/udev/rules.d/ cp -vf %{DIR_SOURCE}/udev/* %{BUILDROOT}/lib/udev/rules.d/ @@ -66,6 +69,10 @@ packages util-linux end + configfiles + /etc/rc.local + end + prerequires = coreutils shadow-utils script prein @@ -77,6 +84,23 @@ packages chown root:utmp /var/log/{b,w}tmp /var/run/utmp chmod 664 /var/log/wtmp /var/run/utmp chmod 600 /var/log/btmp + + # Just search for new unit files that were just installed. + /bin/systemctl daemon-reload >/dev/null 2>&1 || : + + # Enable rc.local as default. + /bin/systemctl --no-reload enable rc-local.service >/dev/null 2>&1 || : + end + + # Disable the service that is to be removed and stop it if it is still running. + script preun + /bin/systemctl --no-reload disable rc-local.service >/dev/null 2>&1 || : + /bin/systemctl stop rc-local.service >/dev/null 2>&1 || : + end + + # Just tell systemd that unitfiles have been removed. + script postun + /bin/systemctl daemon-reload >/dev/null 2>&1 || : end end end diff --git a/initscripts/rc.local b/initscripts/rc.local new file mode 100644 index 000000000..0bd2d3755 --- /dev/null +++ b/initscripts/rc.local @@ -0,0 +1,4 @@ +#!/bin/sh +# +# This script will be executed at the end of the boot process. +# You can put your own initialization stuff in here. diff --git a/initscripts/systemd/rc-local.service b/initscripts/systemd/rc-local.service new file mode 100644 index 000000000..04daed0fe --- /dev/null +++ b/initscripts/systemd/rc-local.service @@ -0,0 +1,15 @@ +[Unit] +Description=/etc/rc.local Compatiblity +ConditionFileIsExecuteable=/etc/rc.local +Requires=multi-user.target +After=multi-user.target network.target + +[Service] +Type=forking +ExecStart=/etc/rc.local +TimeoutSec=0 +StandardOutput=tty +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target