summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Hubbs <w.d.hubbs@gmail.com>2012-12-06 16:43:24 -0600
committerWilliam Hubbs <w.d.hubbs@gmail.com>2012-12-06 17:57:00 -0600
commit9c4582fbd7674269037d07db9f8432377b747dd2 (patch)
tree6b5cf8f8bd4423d26a616cfe053e9bc4244ab2b2
parentccb068c48451e00dcab49ab7877c6c056f044952 (diff)
downloadopenrc-0.11.7.tar.gz
openrc-0.11.7.tar.bz2
openrc-0.11.7.tar.xz
migrate-to-run: do not require a rebootopenrc-0.11.7
The script that migrates the @libexecdir@/rc/init.d directory to /run/openrc should not require a reboot. Reported-by: chainsaw@gentoo.org
-rw-r--r--sh/init.sh.Linux.in8
-rw-r--r--sh/migrate-to-run.sh.in37
2 files changed, 17 insertions, 28 deletions
diff --git a/sh/init.sh.Linux.in b/sh/init.sh.Linux.in
index 0eca736..f45eae1 100644
--- a/sh/init.sh.Linux.in
+++ b/sh/init.sh.Linux.in
@@ -51,6 +51,10 @@ if [ ! -d /run ]; then
fi
fi
+if [ -L /run/openrc ]; then
+ rm /run/openrc
+fi
+
if [ "$sys" = VSERVER ]; then
rm -rf /run/*
elif ! mountinfo -q /run; then
@@ -84,5 +88,9 @@ if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi
+if [ -e "$RC_LIBEXECDIR"/init.d ]; then
+ rm -rf "$RC_LIBEXECDIR"/init.d
+fi
+
echo sysinit >"$RC_SVCDIR"/softlevel
exit 0
diff --git a/sh/migrate-to-run.sh.in b/sh/migrate-to-run.sh.in
index 73978e7..b18c541 100644
--- a/sh/migrate-to-run.sh.in
+++ b/sh/migrate-to-run.sh.in
@@ -11,38 +11,19 @@ fi
if [ ! -d /run ]; then
eerror "/run is not a directory."
- eerror "This means the OpenRC dependency data cannot be migrated."
- eerror "Please create the /run directory and reboot the system."
- exit 1
+ eerror "moving /run to /run.pre-openrc"
+ mv /run /run.pre-openrc
+ mkdir /run
fi
-if ! mountinfo -q -f tmpfs /run; then
- for x in /run/.* /run/*; do
- case "$x" in
- /run/.|/run/..)
- continue
- ;;
- esac
- if [ -e "$x" ]; then
- eerror "Your /run directory contains files."
- eerror "Please reboot the system."
- exit 1
- fi
- done
+rm -rf /run/openrc
- mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run 2> /dev/null
- if [ $? != 0 ]; then
- eerror "Unable to mount a tmpfs on /run."
- eerror "This means the OpenRC dependency data cannot be migrated."
- eerror "Please create the /run directory and reboot the system."
- exit 1
- fi
+if ! mountinfo -q -f tmpfs /run; then
+ ln -s "@LIBEXECDIR@"/init.d /run/openrc
+else
+ cp -a "@LIBEXECDIR@/init.d" /run/openrc
+ rc-update -u
fi
-rm -rf /run/openrc
-cp -a "@LIBEXECDIR@/init.d" /run/openrc
-rc-update -u
-umount "@LIBEXECDIR@/init.d"
-rm -rf "@LIBEXECDIR@/init.d"
einfo "The OpenRC dependency data was migrated successfully."
exit 0