openrc/sh/migrate-to-run.sh.in
William Hubbs 9314ac64ea migrate-to-run: fix test for successful migration
This script originally tested the file system type for the source
location of the data we were migrating to determine if the migration was
complete. Now we test the destination, and if the softlevel file is
there the migration was successful.

Reported-by: Piotr Karbowski <piotr.karbowski@gmail.com>
2013-04-03 11:25:19 -05:00

30 lines
630 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 [ -e /run/openrc/softlevel ]; 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