File: udev.udev-mtab.init

package info (click to toggle)
udev 0.105-4etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 672 kB
  • ctags: 54
  • sloc: sh: 1,636; makefile: 273
file content (51 lines) | stat: -rw-r--r-- 1,252 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh -e
### BEGIN INIT INFO
# Provides:          udev-mtab
# Required-Start:    udev checkroot
# Required-Stop:     
# Default-Start:     S
# Default-Stop:
# Short-Description: Add to mtab the entries for /dev and /dev/.static/dev.
### END INIT INFO

PATH="/sbin:/bin"

# copy the rules generated before / was mounted read-write
for file in /dev/.udev/tmp-rules--*; do
  dest=${file##*tmp-rules--}
  [ "$dest" = '*' ] && break
  cat $file >> /etc/udev/rules.d/$dest
  rm -f $file
done


# if it's not, it's probably a symlink to /proc/mounts
[ -w /etc/mtab ] || exit 0

# defaults
tmpfs_size="10M"
udev_root="/dev/"

. /etc/udev/udev.conf

# strip the trailing slash
udev_root=${udev_root%/}

if mountpoint -q $udev_root; then
  grep -E --quiet --no-messages "^[^ ]+ +$udev_root +" /etc/mtab || \
    mount -f -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs $udev_root
fi

# /dev/.static/dev/ is not added to mtab because /dev/.static/ is not
# world readable and some users are annoyed by the resulting error
# message from df.
exit 0

# mountpoint(1) does not report bind mounts
if [ -e /dev/.static/dev/null ]; then
  grep -E --quiet --no-messages "^[^ ]+ +/dev/\.static/dev +" /etc/mtab || \
    mount -f --bind /dev /dev/.static/dev
fi

exit 0