Do not add a prefix to the /run directory

This doesn't affect us on gentoo, but on archlinux, which has done the
/usr merge, OpenRC was looking for /run under PREFIX. /run is always at
the root level, so it shouldn't have prefix appended to it.

Reported-by: udeved@openrc4arch.site40.net
This commit is contained in:
William Hubbs 2012-12-03 18:33:21 -06:00
parent 31bcc6bee4
commit a9272f50f7
2 changed files with 13 additions and 14 deletions

View File

@ -9,39 +9,38 @@ if ! mountinfo -q -f tmpfs "@LIBEXECDIR@/init.d"; then
exit 0 exit 0
fi fi
if [ ! -d "@PREFIX@/run" ]; then if [ ! -d /run ]; then
eerror "'@PREFIX@/run' is not a directory." eerror "/run is not a directory."
eerror "This means the OpenRC dependency data cannot be migrated." eerror "This means the OpenRC dependency data cannot be migrated."
eerror "Please create the '@PREFIX@/run' directory and reboot the system." eerror "Please create the /run directory and reboot the system."
exit 1 exit 1
fi fi
if ! mountinfo -q -f tmpfs "@PREFIX@/run"; then if ! mountinfo -q -f tmpfs /run; then
for x in "@PREFIX@/run/."* "@PREFIX@/run/"*; do for x in /run/.* /run/*; do
case "$x" in case "$x" in
"@PREFIX@/run/."|"@PREFIX@/run/..") /run/.|/run/..)
continue continue
;; ;;
esac esac
if [ -e "$x" ]; then if [ -e "$x" ]; then
eerror "Your '@PREFIX@/run' directory contains files." eerror "Your /run directory contains files."
eerror "Please reboot the system." eerror "Please reboot the system."
exit 1 exit 1
fi fi
done done
mount -t tmpfs -o mode=0755,nosuid,nodev \ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run 2> /dev/null
tmpfs "@PREFIX@/run" 2> /dev/null
if [ $? != 0 ]; then if [ $? != 0 ]; then
eerror "Unable to mount a tmpfs on '@PREFIX@/run'." eerror "Unable to mount a tmpfs on /run."
eerror "This means the OpenRC dependency data cannot be migrated." eerror "This means the OpenRC dependency data cannot be migrated."
eerror "Please create the '@PREFIX@/run' directory and reboot the system." eerror "Please create the /run directory and reboot the system."
exit 1 exit 1
fi fi
fi fi
rm -rf "@PREFIX@/run/openrc" rm -rf /run/openrc
cp -a "@LIBEXECDIR@/init.d" "@PREFIX@/run/openrc" cp -a "@LIBEXECDIR@/init.d" /run/openrc
rc-update -u rc-update -u
umount "@LIBEXECDIR@/init.d" umount "@LIBEXECDIR@/init.d"
rm -rf "@LIBEXECDIR@/init.d" rm -rf "@LIBEXECDIR@/init.d"

View File

@ -40,7 +40,7 @@ __BEGIN_DECLS
#if defined(PREFIX) #if defined(PREFIX)
#define RC_SVCDIR RC_LIBEXECDIR "/init.d" #define RC_SVCDIR RC_LIBEXECDIR "/init.d"
#elif defined(__linux__) #elif defined(__linux__)
#define RC_SVCDIR "@PREFIX@/run/openrc" #define RC_SVCDIR "/run/openrc"
#else #else
#define RC_SVCDIR RC_LIBEXECDIR "/init.d" #define RC_SVCDIR RC_LIBEXECDIR "/init.d"
#endif #endif