[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: help: 2.4.0 kernel and /dev/shm



On Thu, Jan 11, 2001 at 10:20:20AM -0500, Bob Billson wrote:
> 
> I was looking at /etc/init.d/devpts.sh.  In the 2.2.x kernel docs, recommends
> adding an appropriate line to /etc/fstab.  However, Debian choose not to and
> does it in a boot script instead; not sure why.  I am tempted to hack together
> a similar script for shm.  

i already went with this approach and it works quite well, my script
is below.  it also mounts usbdevfs.  

the reason debian uses a script instead of fstab is because 2.0
kernels do not support /dev/pts (and 2.0 kernels are still supported
on potato, they have to be since kernels are not upgraded in a
dist-upgrade) also if for some reason you actually wanted to use devfs
you no longer have /dev/pts.  under these conditions mount pukes with
a fstab line, where a shell script can intelligently look at what you
have and do the Right Thing.

> Which is apparently what is used to be.  Looks like /dev/shm is the approved
> mount point.

yup

here is my `miscfs.sh' script.  i linked it to
/etc/rcS.d/S35miscfs.sh, so it runs right after /dev/pts.  

#! /bin/sh
set -e

[ "$(uname -s)" = "Linux" ] || exit 0

version="$(uname -r)"

make_devshm()
{
    [ -d /dev/shm ] || mkdir --mode=755 /dev/shm
}

mount_devshm_fs()
{
    mount -t shm shm /dev/shm
}

mount_devusb_fs()
{
    mount -t usbdevfs usbdevfs /proc/bus/usb
}

devshm=$(grep -c '\<shm' /proc/filesystems || true)
devusb=$(grep -c '\<usbdevfs' /proc/filesystems || true)
devshm_mounted=$(mount | grep -c '/dev/shm' || true)
devusb_mounted=$(mount | grep -c '/proc/bus/usb' || true)

if [ $devshm_mounted -lt 1 -a $devshm != 0 ] ; then
    make_devshm
    mount_devshm_fs
fi

if [ $devusb_mounted -lt 1 -a $devusb != 0 ] ; then
    mount_devusb_fs
fi

exit 0


-- 
Ethan Benson
http://www.alaska.net/~erbenson/

Attachment: pgpM45p00UBwD.pgp
Description: PGP signature


Reply to: