OpenRC: improve /run creation.

This commit is contained in:
Juan RP 2011-05-04 13:11:19 +02:00
parent ba2205d461
commit 548b8f1224
2 changed files with 20 additions and 41 deletions

View file

@ -12,8 +12,7 @@ xbps changes:
* The mtab service checks if / is of type rootfs and tmpfs, and don't add it
into /etc/mtab, which is redundant.
* mount_svcdir() doesn't mount any tmpfs or ramfs anymore, rather mounts an
tmpfs in /run and creates compat symlinks on it for /tmp, /dev/shm, /var/tmp,
/var/lock, /var/run, etc.
tmpfs in /run and creates a compat symlink for /dev/shm.
* Backported a patch to skip unmounting the /run mountpoint from upstream
git repo (Gentoo).
@ -178,9 +177,9 @@ xbps changes:
; do
set -- $x
grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue
--- sh/init.sh.Linux.in.orig 2011-04-29 22:12:20.648999920 +0200
+++ sh/init.sh.Linux.in 2011-04-29 22:15:20.159999881 +0200
@@ -3,59 +3,42 @@
--- sh/init.sh.Linux.in.orig 2011-02-10 06:15:24.000000000 +0100
+++ sh/init.sh.Linux.in 2011-05-04 13:03:07.481471247 +0200
@@ -3,59 +3,22 @@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
@ -213,25 +212,8 @@ xbps changes:
- if [ $? -eq 0 ]; then
- svcdir_restorecon
- [ $? -eq 0 ] && return 0
+ # Mount /run as tmpfs.
+ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
+ # Create required /run directories.
+ for d in init.d pid udev; do
+ mkdir -m0755 /run/${d}
+ done
+ for d in lock tmp shm; do
+ mkdir -m1777 /run/${d}
+ done
+
+ # Create /run compat symlinks.
+ if [ "$(readlink -f /lib/rc/init.d)" != "/run/init.d" ]; then
+ rm -rf /lib/rc/init.d
+ ln -sf /run/init.d /lib/rc/init.d
fi
+ if [ "$(readlink -f /tmp)" != "/run/tmp" ]; then
+ rm -rf /tmp
+ ln -sf /run/tmp /tmp
fi
- fi
- fi
-
- if grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then
- fs="ramfs"
@ -248,26 +230,25 @@ xbps changes:
- eerror "compiled into the kernel"
- echo
- return 1
+ if [ "$(readlink -f /var/tmp)" != "/run/tmp" ]; then
+ rm -rf /var/tmp
+ ln -sf /run/tmp /var/tmp
fi
-
- fi
+ # Mount /run as tmpfs.
+ mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
- mount -n -t "$fs" $fsopts rc-svcdir "$RC_SVCDIR"
- if [ $? -eq 0 ]; then
- svcdir_restorecon
- [ $? -eq 0 ] && return 0
+ for d in init.d pid udev; do
+ mkdir -m0755 /run/${d}
+ done
+ for d in lock tmp shm; do
+ mkdir -m1777 /run/${d}
+ done
+
+ # Create /dev/shm -> /run/shm compat symlink.
+ if [ "$(readlink -f /dev/shm)" != "/run/shm" ]; then
+ rm -rf /dev/shm
+ ln -sf /run/shm /dev/shm
+ fi
+ if [ "$(readlink -f /var/run)" != "/run/pid" ]; then
+ rm -rf /var/run
+ ln -sf /run/pid /var/run
+ fi
+ if [ "$(readlink -f /var/lock)" != "/run/lock" ]; then
+ rm -rf /var/lock
+ ln -sf /run/lock /var/lock
fi
}

View file

@ -1,7 +1,7 @@
# Template file for 'OpenRC'
pkgname=OpenRC
version=20110211
revision=4
revision=5
wrksrc=openrc-${version}
distfiles="http://xbps.nopcode.org/distfiles/openrc-$version.tar.bz2"
build_style=custom-install
@ -45,9 +45,6 @@ _branding="XBPS GNU/Linux"
do_build()
{
# Use cmp(1) from diffutils.
export PATH="/usr/bin:$PATH"
# Install the "locale" service
cp ${FILESDIR}/locale.rc ${wrksrc}/init.d/locale.in
@ -79,4 +76,5 @@ do_install()
chmod 755 ${DESTDIR}/lib/lib*
chmod 755 ${DESTDIR}/usr/lib/lib*
rmdir ${DESTDIR}/lib/rc/init.d
}