File: 15-mount-proc.sh

package info (click to toggle)
rinse 4.3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 260 kB
  • sloc: perl: 891; sh: 396; makefile: 87
file content (34 lines) | stat: -rwxr-xr-x 445 bytes parent folder | download | duplicates (7)
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
#!/bin/sh
#
#  Ensure the chroot has /proc + /sys mounted.
#
# Steve
# --


#
#  Get the root of the chroot.
#
prefix=$1

#
#  Ensure it exists.
#
if [ ! -d "${prefix}" ]; then
  echo "Serious error - the named directory doesn't exist."
  exit
fi

#
#  Mount /proc + /sys
#
for i in /proc /sys; do
    if [ ! -d "${prefix}/$i" ]; then
        mkdir -p "${prefix}/$i"
    fi

    #
    #  Bind-mount
    #
    mount -o bind $i ${prefix}/${i}
done