summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <williamh@gentoo.org>2011-11-30 10:00:44 -0600
committerWilliam Hubbs <williamh@gentoo.org>2011-12-03 12:46:52 -0600
commit5adb3930c7a875153c0b817b5c21596a3faaac29 (patch)
tree6afd4ee806cbc2eb92fa00c3a93ab55cbb421f2a
parentb628481701d1f240ff8b2411dc041db332578a8c (diff)
downloadopenrc-5adb3930c7a875153c0b817b5c21596a3faaac29.tar.gz
openrc-5adb3930c7a875153c0b817b5c21596a3faaac29.tar.bz2
openrc-5adb3930c7a875153c0b817b5c21596a3faaac29.tar.xz
Integrate migrate-run into bootmisc
The migrate-run service was hanging when parallel startup was enabled because of its dependencies. This integrates the logic for this service into bootmisc, which will avoid the issues with parallel startup. I would like to thank Robin H. Johnson <robbat2@gentoo.org> for his input on this patch
-rw-r--r--init.d/Makefile2
-rw-r--r--init.d/bootmisc.in37
-rw-r--r--init.d/migrate-run.in37
-rw-r--r--runlevels/Makefile2
4 files changed, 37 insertions, 41 deletions
diff --git a/init.d/Makefile b/init.d/Makefile
index c1eb647..8351f3c 100644
--- a/init.d/Makefile
+++ b/init.d/Makefile
@@ -22,7 +22,7 @@ SRCS-FreeBSD+= adjkerntz.in devd.in dumpon.in ipfw.in mixer.in nscd.in \
NET_LO-Linux= net.lo
SRCS-Linux= devfs.in dmesg.in hwclock.in consolefont.in keymaps.in \
killprocs.in modules.in mount-ro.in mtab.in numlock.in \
- procfs.in sysfs.in termencoding.in migrate-run.in
+ procfs.in sysfs.in termencoding.in
NET_LO-NetBSD= net.lo0
# Generic BSD scripts
diff --git a/init.d/bootmisc.in b/init.d/bootmisc.in
index 31fa0c8..96455ad 100644
--- a/init.d/bootmisc.in
+++ b/init.d/bootmisc.in
@@ -72,6 +72,26 @@ mkutmp()
chmod 0664 "$1"
}
+migrate_to_run()
+{
+ src="$1"
+ dst="$2"
+ if [ -L $src -a "$(readlink -f $src)" != $dst ]; then
+ ewarn "$src does not point to $dst."
+ ewarn "Setting $src to point to $dst."
+ rm $src
+ elif [ ! -L $src -a -d $src ]; then
+ ebegin "Migrating $src to $dst"
+ cp -a $src/* $dst/
+ rm -rf $src
+ eend $?
+ fi
+ # If $src doesn't exist at all, just run this
+ if [ ! -e $src ]; then
+ ln -s $dst $src
+ fi
+}
+
start()
{
# Remove any added console dirs
@@ -79,8 +99,16 @@ start()
local logw=false runw=false extra=
# Ensure that our basic dirs exist
- [ "$RC_UNAME" = Linux ] && extra=/var/lib/misc # Satisfy Linux FHS
- for x in /var/log /var/run /tmp $extra; do
+ if [ "$RC_UNAME" = Linux ]; then
+ # Satisfy Linux FHS
+ extra=/var/lib/misc
+ if [ ! -d /run ]; then
+ extra="/var/run $extra"
+ fi
+ else
+ extra=/var/run
+ fi
+ for x in /var/log /tmp $extra; do
if ! [ -d $x ]; then
if ! mkdir -p $x; then
eend 1 "failed to create needed directory $x"
@@ -89,6 +117,11 @@ start()
fi
done
+ if [ "$RC_UNAME" = Linux -a -d /run ]; then
+ migrate_to_run /var/lock /run/lock
+ migrate_to_run /var/run /run
+ fi
+
if dir_writable /var/run; then
ebegin "Creating user login records"
local xtra=
diff --git a/init.d/migrate-run.in b/init.d/migrate-run.in
deleted file mode 100644
index 02a884d..0000000
--- a/init.d/migrate-run.in
+++ /dev/null
@@ -1,37 +0,0 @@
-#!@PREFIX@/sbin/runscript
-# Copyright 1999-2011 Gentoo Foundation
-# Released under the 2-clause BSD license.
-
-description="Migrate /var/run and /var/lock to /run"
-
-depend()
-{
- before *
- after localmount
-}
-
-start()
-{
- einfo "starting $RC_SVCNAME"
- return 0
-}
-
-stop()
-{
- einfo "completing /var/run and /var/lock migration."
- if [ -d /run ]; then
- if [ ! -L /var/lock ]; then
- ebegin "Migrating /var/lock to /run"
- rm -rf /var/lock
- ln -s /run/lock /var/lock
- eend 0
- fi
- if [ ! -L /var/run ]; then
- ebegin "Migrating /var/run to /run"
- rm -rf /var/run
- ln -s /run /var/run
- eend 0
- fi
- fi
- return 0
-}
diff --git a/runlevels/Makefile b/runlevels/Makefile
index 1f599a9..c1a9f09 100644
--- a/runlevels/Makefile
+++ b/runlevels/Makefile
@@ -26,7 +26,7 @@ BOOT-FreeBSD= hostid net.lo0 newsyslog savecore syslogd
# FreeBSD specific stuff
BOOT-FreeBSD+= adjkerntz dumpon syscons
-BOOT-Linux= hwclock keymaps modules mtab net.lo procfs termencoding migrate-run
+BOOT-Linux= hwclock keymaps modules mtab net.lo procfs termencoding
SHUTDOWN-Linux= killprocs mount-ro
SYSINIT-Linux= devfs dmesg