openrc/sh/migrate-to-run.sh.in
William Hubbs e5173b9127 migrate-to-run: do not require a reboot
The script that migrates the @libexecdir@/rc/init.d directory to
/run/openrc should not require a reboot.

Reported-by: chainsaw@gentoo.org
2012-12-06 16:43:24 -06:00

30 lines
647 B
Bash

#!@SHELL@
# Copyright (c) 2012 William Hubbs <w.d.hubbs@gmail.com>
# Released under the 2-clause BSD license.
. "@LIBEXECDIR@/sh/functions.sh"
if ! mountinfo -q -f tmpfs "@LIBEXECDIR@/init.d"; then
einfo "The OpenRC dependency data has already been migrated."
exit 0
fi
if [ ! -d /run ]; then
eerror "/run is not a directory."
eerror "moving /run to /run.pre-openrc"
mv /run /run.pre-openrc
mkdir /run
fi
rm -rf /run/openrc
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
einfo "The OpenRC dependency data was migrated successfully."
exit 0