Update packages to use /run and compat symlinks inside of it.

/run is now used explicitly by udev>=167 so I followed the lead and
updated XBPS core packages to use it by default.
This commit is contained in:
Juan RP 2011-04-29 20:26:58 +02:00
parent 948728e2ec
commit 6b4cb03a83
8 changed files with 153 additions and 65 deletions

View file

@ -7,12 +7,15 @@ xbps changes:
* Modified inittab to pass correct parameters to reboot(8).
* Sets unicode, rc_logger and rc_shell in /etc/rc.conf by default.
* Sets windowkeys and fix_euro in /etc/conf.d/keymaps by default.
* The sysfs service mounts /var/run, /var/lock and /var/tmp as tmpfs with
appropiate permissions.
* The bootmisc service no longer cleans up /var/run, as it is now mounted tmpfs.
* The devfs service mounts /dev/shm with type tmpfs rather than "shm".
* The bootmisc service no longer cleans up /var/run, as it is now mounted tmpfs
(symlinked to /run, which is tmpfs).
* 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 uses symlinks
pointing to the /run directory which is always a tmpfs. Compat symlinks
for common dirs are also provided.
* Backported a patch to skip unmounting the /run mountpoint from upstream
git repo (Gentoo).
--- runlevels/Makefile.Linux.orig 2009-05-07 15:48:37.075825332 +0000
+++ runlevels/Makefile.Linux 2009-05-07 15:48:52.008557039 +0000
@ -109,52 +112,6 @@ xbps changes:
# Network fstypes. Below is the default.
net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs nfs nfs4 ocfs2 shfs smbfs"
--- init.d/sysfs.in.orig 2011-01-16 12:42:39.930029312 +0100
+++ init.d/sysfs.in 2011-01-16 12:43:08.090153349 +0100
@@ -52,13 +52,39 @@ mount_misc()
fi
}
+mount_var_run_lock()
+{
+ local _args _mode _mnt
+
+ for _mnt in run lock tmp; do
+ if [ "${_mnt}" != "run" ]; then
+ _mode=1777
+ _args="mode=${_mode},nosuid,noexec,nodev"
+ else
+ _mode=0755
+ _args="mode=${_mode},nosuid"
+ fi
+ if [ ! -d /var/${_mnt} ]; then
+ if ! mkdir -m ${_mode} /var/${_mnt}; then
+ ewarn "Could not create /var/${_mnt}!"
+ return 1
+ fi
+ fi
+
+ ebegin "Mounting /var/${_mnt}"
+ if ! fstabinfo --mount /var/${_mnt}; then
+ mount -n -t tmpfs -o ${_args} tmpfs /var/${_mnt}
+ fi
+ eend $?
+ done
+}
+
start()
{
- local retval
mount_sys
- retval=$?
- if [ $retval -eq 0 ]; then
+ if [ $? -eq 0 ]; then
mount_misc
fi
- return $retval
+ mount_var_run_lock
+ return $?
}
--- init.d/mtab.in.orig 2011-01-16 12:44:28.947251849 +0100
+++ init.d/mtab.in 2011-01-16 12:44:37.896926832 +0100
@@ -28,7 +28,7 @@ start()
@ -200,14 +157,124 @@ xbps changes:
fi
# Clean up /tmp directories
--- init.d/devfs.in.orig 2011-01-16 12:46:46.645636416 +0100
+++ init.d/devfs.in 2011-01-16 12:46:58.783551737 +0100
@@ -13,7 +13,7 @@ start() {
--- init.d/localmount.in.orig 2011-04-29 17:06:22.273007691 +0200
+++ init.d/localmount.in 2011-04-29 17:06:50.247007699 +0200
@@ -49,7 +49,7 @@ stop()
fi
if [ "$RC_UNAME" = Linux ]; then
- no_umounts_r="$no_umounts_r|/proc|/proc/.*|/sys|/sys/.*"
+ no_umounts_r="$no_umounts_r|/proc|/proc/.*|/run|/sys|/sys/.*"
fi
no_umounts_r="^($no_umounts_r)$"
--- sh/init.sh.Linux.in.orig 2011-02-10 06:15:24.000000000 +0100
+++ sh/init.sh.Linux.in 2011-04-29 18:11:13.254999893 +0200
@@ -3,59 +3,50 @@
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
-# This basically mounts $RC_SVCDIR as a ramdisk.
-# The tricky part is finding something our kernel supports
-# tmpfs and ramfs are easy, so force one or the other.
-svcdir_restorecon()
-{
- local rc=0
- if [ -x /usr/sbin/selinuxenabled -a -c /selinux/null ] &&
- selinuxenabled; then
- restorecon $RC_SVCDIR
- rc=$?
- fi
- return $rc
-}
-
+# /lib/rc/init.d should be rw, previously it was mounted as tmpfs or
+# ramfs. XBPS no longer mounts this, rather uses a symlink to /run/init.d
+# which is always a tmpfs.
+#
mount_svcdir()
{
- # mount from fstab if we can
- fstabinfo --mount "$RC_SVCDIR" && return 0
-
- local fs= fsopts="-o rw,noexec,nodev,nosuid"
- local svcsize=${rc_svcsize:-1024}
+ # Create /lib/rc/init.d symlink to /run/init.d.
+ if [ ! -d /run/init.d ]; then
+ mkdir -p -m 0755 /run/init.d
+ fi
+ rm -rf /lib/rc/init.d && ln -sf /run/init.d /lib/rc/init.d
- # Some buggy kernels report tmpfs even when not present :(
- if grep -Eq "[[:space:]]+tmpfs$" /proc/filesystems; then
- local tmpfsopts="${fsopts},mode=755,size=${svcsize}k"
- mount -n -t tmpfs $tmpfsopts rc-svcdir "$RC_SVCDIR"
- if [ $? -eq 0 ]; then
- svcdir_restorecon
- [ $? -eq 0 ] && return 0
+ # Create compatibility symlinks for:
+ #
+ # /tmp -> /run/tmp
+ # /var/tmp -> /run/tmp
+ # /var/lock -> /run/lock
+ # /var/run -> /run/pid
+ # /dev/shm -> /run/shm
+
+ [ ! -d /run/tmp ] && mkdir -m 1777 /run/tmp
+ [ ! -d /run/lock ] && mkdir -m 1777 /run/lock
+ [ ! -d /run/pid ] && mkdir -m 0755 /run/pid
+ [ ! -d /run/shm ] && mkdir -m 1777 /run/shm
+
+ if [ -d /tmp ]; then
+ rmdir /tmp
+ ln -sf /run/tmp /tmp
fi
+ if [ -d /var/tmp ]; then
+ rmdir /var/tmp
+ ln -sf /run/tmp /var/tmp
fi
-
- if grep -Eq "[[:space:]]+ramfs$" /proc/filesystems; then
- fs="ramfs"
- # ramfs has no special options
- elif [ -e /dev/ram0 ] \
- && grep -Eq "[[:space:]]+ext2$" /proc/filesystems; then
- devdir="/dev/ram0"
- fs="ext2"
- dd if=/dev/zero of="$devdir" bs=1k count="$svcsize"
- mkfs -t "$fs" -i 1024 -vm0 "$devdir" "$svcsize"
- else
- echo
- eerror "OpenRC requires tmpfs, ramfs or a ramdisk + ext2"
- eerror "compiled into the kernel"
- echo
- return 1
+ if [ -d /var/run ]; then
+ rm -rf /var/run
+ ln -sf /run/pid /var/run
fi
-
- mount -n -t "$fs" $fsopts rc-svcdir "$RC_SVCDIR"
- if [ $? -eq 0 ]; then
- svcdir_restorecon
- [ $? -eq 0 ] && return 0
+ if [ -d /var/lock ]; then
+ rmdir /var/lock
+ ln -sf /run/lock /var/lock
+ fi
+ if [ -d /run/shm ]; then
+ [ -d /dev/shm ] && rmdir /dev/shm
+ ln -sf /run/shm /dev/shm
fi
}
--- init.d/devfs.in.orig 2011-02-10 06:15:24.000000000 +0100
+++ init.d/devfs.in 2011-04-29 18:12:48.983999871 +0200
@@ -13,7 +13,6 @@ start() {
# Mount required stuff as user may not have then in /etc/fstab
for x in \
"devpts /dev/pts 0755 ,gid=5,mode=0620 devpts" \
- "tmpfs /dev/shm 1777 ,nodev shm" \
+ "tmpfs /dev/shm 1777 ,nodev tmpfs" \
; do
set -- $x
grep -Eq "[[:space:]]+$1$" /proc/filesystems || continue

View file

@ -1,7 +1,7 @@
# Template file for 'OpenRC'
pkgname=OpenRC
version=20110211
revision=1
revision=2
wrksrc=openrc-${version}
distfiles="http://xbps.nopcode.org/distfiles/openrc-$version.tar.bz2"
build_style=custom-install

View file

@ -8,6 +8,7 @@ for f in $(/bin/busybox --list); do
/bin/busybox ln -s /bin/busybox /bin/${f}
done
[ -d /run ] || mkdir -m 0755 /run
[ -d /dev ] || mkdir -m 0755 /dev
[ -d /root ] || mkdir -m 0700 /root
[ -d /sys ] || mkdir /sys
@ -21,14 +22,19 @@ mount -t proc -o nodev,noexec,nosuid proc /proc
if [ -e /etc/udev/udev.conf ]; then
. /etc/udev/udev.conf
fi
if ! mount -t devtmpfs -o mode=0755 devtmpfs /dev; then
tmpfs_size="10M"
tmpfs_size="10M"
# Mount devtmpfs for /dev, fallback to tmpfs if not supported.
if ! mount -t devtmpfs -o size=$tmpfs_size,mode=0755 devtmpfs /dev; then
echo "W: devtmpfs not available, falling back to tmpfs for /dev"
mount -t tmpfs -o size=$tmpfs_size,mode=0755 udev /dev
[ -e /dev/console ] || mknod -m 0600 /dev/console c 5 1
[ -e /dev/null ] || mknod /dev/null c 1 3
fi
mkdir /dev/.initramfs
# Also mount a tmpfs for /run directory.
mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs /run
mkdir /run/udev
mkdir /run/.initramfs
# Set modprobe env
export MODPROBE_OPTIONS="-qb"
@ -158,7 +164,7 @@ for x in $(cat /proc/cmdline); do
debug)
debug=y
quiet=n
exec >/dev/.initramfs/initramfs.debug 2>&1
exec >/run/.initramfs/initramfs.debug 2>&1
set -x
;;
debug=*)
@ -290,10 +296,13 @@ unset readonly
unset resume
unset resume_offset
# Umount sysfs and procfs, they will be mounted by init scripts.
# Umount misc filesystems, they will be mounted by the init scripts.
umount /sys
umount /proc
# Move /run to the final rootfs, so that .initramfs debug is available.
mount -n -o move /run ${rootmnt}/run
# Chain to real filesystem
exec switch_root ${rootmnt} ${init} "$@"
panic "Could not execute run-init."

View file

@ -1,6 +1,6 @@
# Template file for 'initramfs-tools'
pkgname=initramfs-tools
_localver=0.99.10 # This is the XBPS version
_localver=0.99.11 # This is the XBPS version
_distver=0.98.8 # This should match debian version
version=${_localver}.${_distver}
build_style=custom-install

View file

@ -17,8 +17,11 @@ case "$1" in
esac
# Stop udevd, we'll miss a few events while we run init, but we catch up
# Kill the udev daemon.
pkill udevd
# Clean up udev state stuff.
udevadm info --cleanup-db
# Move /dev to the real filesystem
mount -n -o move /dev ${rootmnt}/dev

View file

@ -26,7 +26,6 @@ udevd --daemon --resolve-names=never
# Iterate sysfs and fire off everything; if we include a rule for it then
# it'll get handled; otherwise it'll get handled later when we do this again
# in the main boot sequence.
mkdir -p /dev/.udev/queue/
udevadm trigger --action=add
udevadm settle || true

View file

@ -4,7 +4,7 @@
command=/sbin/udevd
command_args="--daemon"
name="UDev Daemon"
name="udev daemon"
depend()
{
@ -18,8 +18,17 @@ start()
{
echo > /proc/sys/kernel/hotplug
ebegin "Starting UDev and waiting for uevents"
[ ! -d /run/udev ] && mkdir -p /run/udev
ebegin "Starting udev and waiting for uevents"
${command} ${command_args} && \
udevadm trigger --action=add && udevadm settle
eend $?
}
stop()
{
ebegin "Stopping udev daemon"
udevadm control --exit
eend $?
}

View file

@ -1,6 +1,7 @@
# Template file for 'udev'
pkgname=udev
version=168
revision=1
distfiles="${KERNEL_SITE}/utils/kernel/hotplug/udev-${version}.tar.bz2"
build_style=gnu_configure
configure_args="--exec-prefix= --without-selinux --libexecdir=/lib/udev