]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
initscripts: Add /etc/rc.local.
authorStefan Schantl <stefan.schantl@ipfire.org>
Tue, 1 Nov 2011 12:17:01 +0000 (13:17 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Tue, 1 Nov 2011 12:52:56 +0000 (13:52 +0100)
This file allows own instructions and will be executed at the end of the boot process.

Fixes #273

initscripts/initscripts.nm
initscripts/rc.local [new file with mode: 0644]
initscripts/systemd/rc-local.service [new file with mode: 0644]

index ad1141ec786b4b43fa77e8f1883e56a0757cd93d..08850f82fad35fb1a92d9fd7490b65b0c95e3723 100644 (file)
@@ -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 (file)
index 0000000..0bd2d37
--- /dev/null
@@ -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 (file)
index 0000000..04daed0
--- /dev/null
@@ -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