File: postinst

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: -rwxr-xr-x 774 bytes parent folder | download | duplicates (5)
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
#! /bin/sh -e

log () {
	logger -t grub-installer "$@"
}

error () {
	log "error: $@"
}

die () {
	local template="$1"
	shift

	error "$@"
	db_input critical "$template" || [ $? -eq 30 ]
	db_go || true
	exit 1
}

mountvirtfs () {
	fstype="$1"
	path="$2"
	if grep -q "[[:space:]]$fstype\$" /proc/filesystems && \
	   ! grep -q "^[^ ]\+ \+$path " /proc/mounts; then
		mkdir -p "$path" || \
			die grub-installer/mounterr "Error creating $path"
		mount -t "$fstype" "$fstype" "$path" || \
			die grub-installer/mounterr "Error mounting $path"
		trap "umount $path" HUP INT QUIT KILL PIPE TERM EXIT
	fi
}

# If we're installing grub-efi, it wants /sys mounted in the
# target. Maybe /proc too?
mountvirtfs proc /target/proc
mountvirtfs sysfs /target/sys

grub-installer /target