File: initrd-tools.sh

package info (click to toggle)
initrd-tools 0.1.84.2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 156 kB
  • ctags: 32
  • sloc: sh: 1,698; makefile: 45
file content (32 lines) | stat: -rw-r--r-- 658 bytes parent folder | download | duplicates (3)
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
#!/bin/sh
#
# initrd-tools.sh	Unmount and free the initrd.
#
# Version:		$Id: initrd-tools.sh,v 1.5 2002/08/18 00:10:30 herbert Exp $
#

. /etc/default/initrd-tools.sh

[ "$KEEPINITRD" = yes ] && exit
command -v blockdev > /dev/null 2>&1 || exit 0

[ -f /proc/mounts ] || {
	mount -n /proc || exit
	trap 'umount -n /proc' EXIT
}

grep -q '^[^ ]* /initrd ' /proc/mounts || exit 0

if [ -c /initrd/dev/.devfsd ]; then
	umount /initrd/dev || exit
fi
umount /initrd || exit

if [ -b /dev/ram0 ]; then
	blockdev --flushbufs /dev/ram0
elif [ -b /dev/rd/0 ]; then
	blockdev --flushbufs /dev/rd/0
else
	echo "freeinitrd.sh: Cannot find initrd device" >&2
	exit 1
fi