OpenRC: make /etc/mtab a symlink to /proc/self/mounts.

This commit is contained in:
Juan RP 2011-06-25 16:27:59 +02:00
parent 8394166da0
commit 68804663ef
2 changed files with 38 additions and 14 deletions

View File

@ -9,8 +9,7 @@ xbps changes:
* Sets windowkeys and fix_euro in /etc/conf.d/keymaps by default. * Sets windowkeys and fix_euro in /etc/conf.d/keymaps by default.
* The bootmisc service no longer cleans up /var/run, as it is now mounted tmpfs * The bootmisc service no longer cleans up /var/run, as it is now mounted tmpfs
(symlinked to /run, which is tmpfs). (symlinked to /run, which is tmpfs).
* The mtab service checks if / is of type rootfs and tmpfs, and don't add it * The mtab service now symlinks /proc/self/mounts to /etc/mtab.
into /etc/mtab, which is redundant.
* mount_svcdir() doesn't mount any tmpfs or ramfs anymore, rather mounts an * mount_svcdir() doesn't mount any tmpfs or ramfs anymore, rather mounts an
tmpfs in /run if not already mounted and creates a compat symlink for /dev/shm. tmpfs in /run if not already mounted and creates a compat symlink for /dev/shm.
* Backported a patch to skip unmounting the /run mountpoint from upstream * Backported a patch to skip unmounting the /run mountpoint from upstream
@ -111,17 +110,6 @@ xbps changes:
# Network fstypes. Below is the default. # 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" net_fs_list="afs cifs coda davfs fuse fuse.sshfs gfs glusterfs lustre ncpfs nfs nfs4 ocfs2 shfs smbfs"
--- 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()
# makes / readonly and dismounts all tmpfs even if in use which is
# not good. Luckily, umount uses /etc/mtab instead of /proc/mounts
# which allows this hack to work.
- grep -v "^[^ ]* / tmpfs " /proc/mounts > /etc/mtab
+ egrep -v "^[^ ]* / (rootfs|tmpfs) " /proc/mounts > /etc/mtab
# Remove stale backups
rm -f /etc/mtab~ /etc/mtab~~
--- init.d/bootmisc.in.orig 2011-01-16 12:45:10.633395765 +0100 --- init.d/bootmisc.in.orig 2011-01-16 12:45:10.633395765 +0100
+++ init.d/bootmisc.in 2011-01-16 12:46:00.591163353 +0100 +++ init.d/bootmisc.in 2011-01-16 12:46:00.591163353 +0100
@@ -97,31 +97,6 @@ start() @@ -97,31 +97,6 @@ start()
@ -272,3 +260,39 @@ xbps changes:
m="$m|/bin|/sbin|/lib|/libexec" m="$m|/bin|/sbin|/lib|/libexec"
# RC_NO_UMOUNTS is an env var that can be set by plugins # RC_NO_UMOUNTS is an env var that can be set by plugins
local OIFS=$IFS SIFS=${IFS-y} IFS=$IFS local OIFS=$IFS SIFS=${IFS-y} IFS=$IFS
--- init.d/mtab.in.orig 2011-06-25 16:16:49.284716701 +0200
+++ init.d/mtab.in 2011-06-25 16:18:13.986716755 +0200
@@ -6,31 +6,11 @@ description="Update /etc/mtab to match w
depend()
{
- need root
+ need root procfs
keyword -prefix
}
start()
{
- # /etc/mtab could be a symlink to /proc/mounts
- if [ ! -w /etc/mtab -a -L /etc/mtab ]; then
- eeinfo "Skipping mtab update (non writeable symlink)"
- return 0
- fi
-
- ebegin "Updating /etc/mtab"
- if ! echo 2>/dev/null >/etc/mtab; then
- ewend 1 "/etc/mtab is not updateable"
- return 0
- fi
-
- # With / as tmpfs we cannot umount -at tmpfs in localmount as that
- # makes / readonly and dismounts all tmpfs even if in use which is
- # not good. Luckily, umount uses /etc/mtab instead of /proc/mounts
- # which allows this hack to work.
- grep -v "^[^ ]* / tmpfs " /proc/mounts > /etc/mtab
-
- # Remove stale backups
- rm -f /etc/mtab~ /etc/mtab~~
- eend 0
+ [ ! -h /etc/mtab ] && ln -sf /proc/self/mounts /etc/mtab
}

View File

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