This is the code I plan to use.
# mount -n is used because it gets very confused by --bind (see #282205)
tempdir() {
local dir=$(tempfile ${1:+--prefix=$1})
rm $dir
mkdir $dir
echo $dir
}
# create the directory which will hold our new /dev
TEMPDEV=$(tempdir)
mount -n --bind /dev /.dev
mount -n -o size=5M,mode=0755 -t tmpfs none $TEMPDEV
mkdir $TEMPDEV/pts/ $TEMPDEV/shm/
mount -n --bind /dev/pts/ $TEMPDEV/pts/
mount -n --bind /dev/shm/ $TEMPDEV/shm/
# make symlinks to the sockets and pipes on the old /dev
find /dev -type s -o -type p | sed "s@/dev/@@" | \
while read file; do
ln -s "/.dev/$file" "$TEMPDEV/$file"
done
# create a new config file which points to the temporary /dev
TEMPCONF=$(tempfile --prefix=udev.conf.)
sed -e "s#/dev/#$TEMPDEV/#" < /etc/udev/udev.conf > $TEMPCONF
UDEV_TEST=1 UDEV_CONFIG_FILE=$TEMPCONF /sbin/udevstart
rm $TEMPCONF
mount -n --move $TEMPDEV /dev
--
ciao, |
Marco | [9941 unLAT7V2B0J3c]
Attachment:
signature.asc
Description: Digital signature