File: functions.sh

package info (click to toggle)
grub-installer 1.85
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,596 kB
  • sloc: sh: 1,234; ansic: 92; makefile: 13
file content (39 lines) | stat: -rw-r--r-- 981 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
35
36
37
38
39
# Make sure mtab in the chroot reflects the currently mounted partitions.
update_mtab_procfs() {
	grep "$ROOT" /proc/mounts | (
	while read devpath mountpoint fstype options n1 n2 ; do
		devpath=`mapdevfs $devpath || echo $devpath`
		mountpoint=`echo $mountpoint | sed "s%^$ROOT%%"`
		# The sed line removes the mount point for root.
		if [ -z "$mountpoint" ] ; then
			mountpoint="/"
		fi
		echo $devpath $mountpoint $fstype $options $n1 $n2
	done ) > $mtab
}

# No /proc/mounts available, build one (Hurd)
update_mtab_scratch() {
	echo "$rootfs / $rootfstype defaults 0 1" > $mtab
	if [ "$bootfs" != "$rootfs" ]; then
		echo "$bootfs /boot $bootfstype defaults 0 2" >> $mtab
	fi
}

update_mtab() {
	[ "$ROOT" ] || return 0

	[ ! -h "$ROOT/etc/mtab" ] || return 0

	mtab=$ROOT/etc/mtab

	if [ -e /proc/mounts ]; then
		update_mtab_procfs
	else
		update_mtab_scratch
	fi
}

is_floppy () {
	echo "$1" | grep -q '(fd' || echo "$1" | grep -q "/dev/fd" || echo "$1" | grep -q floppy
}