Skip to contentSkip to conversation

reboot-less installation of udev

DISCUSSION Marco d'Itri 1 participant 1 message Dec 19, 2004

lore
Share & tools
lore
#0 lore raw

I'm working to make possible installing the debian udev package without the need for a reboot and without breaking the system. This is an untested draft of what I plan to do. Any comments?

#!/bin/sh -e

# 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 dev)

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

Signature · 2 lines
ciao, |
Marco | [9924 da/2KLWeH3k.E]