@@ -, +, @@ init.d/Makefile | 2 +- init.d/localmount.in | 28 ++++++++++++++++++++++++++++ init.d/migrate-run.in | 30 ------------------------------ runlevels/Makefile | 2 +- 4 files changed, 30 insertions(+), 32 deletions(-) --- a/init.d/Makefile +++ a/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 --- a/init.d/localmount.in +++ a/init.d/localmount.in @@ -4,6 +4,11 @@ description="Mounts disks and swap according to /etc/fstab." +extra_commands="migrate_run" +description_migrate_run="Migrate /var/run and /var/lock to /run" + +skip_migrate_run="${skip_migrate_run:-NO}" + depend() { need fsck @@ -12,6 +17,27 @@ depend() keyword -jail -openvz -prefix -vserver -lxc } +migrate_run() +{ + [ "$RC_UNAME" = Linux ] || return 0 + + einfo "completing /var/run and /var/lock migration." + if [ -d /run/lock -a ! -L /var/lock ]; then + ebegin "Migrating /var/lock to /run" + rm -rf /var/lock + ln -s ../run/lock /var/lock + eend $? + fi + + if [ -d /run -a ! -L /var/run ]; then + ebegin "Migrating /var/run to /run" + rm -rf /var/run + ln -s ../run /var/run + eend $? + fi + return 0 +} + start() { # Mount local filesystems in /etc/fstab. @@ -33,6 +59,8 @@ start() stop() { + yesno "${skip_migrate_run}" || migrate_run + # We never unmount / or /dev or $RC_SVCDIR # Bug 381783 --- a/init.d/migrate-run.in +++ a/init.d/migrate-run.in @@ -1,30 +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 -a ! -L /var/lock -a ! -L /var/run ]; then - ebegin "Migrating /var/lock and /var/run to /run" - rm -rf /var/lock /var/run - ln -s /var/lock /run/lock - ln -s /var/run /run - eend 0 - fi - return 0 -} --- a/runlevels/Makefile +++ a/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