summaryrefslogtreecommitdiff
path: root/debian/initramfs-tools.postinst
blob: 7d4eff68d8183cedf5442d39d08602e57bb1b9e8 (plain)
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
#!/bin/sh

set -e

if [ "$1" = configure ]; then
	if [ x${2} = x ]; then

		# First time install.  Can we autodetect the RESUME partition?
		RESUME=$(tail -n $(($(wc -l /proc/swaps | awk ' { print $1 } ') - 1)) /proc/swaps | sort -rk3 | head -n 1 | awk ' { print $1 } ')

		# Inhertic initrd-tools settings if possible.
		if [ -e /etc/mkinitrd/mkinitrd.conf ]; then
			 . /etc/mkinitrd/mkinitrd.conf
		fi

		if [ -e /etc/mkinitrd/modules ]; then
			cp /etc/mkinitrd/modules /etc/mkinitramfs
			sed -i \
			  -e 's/mkinitrd/mkinitramfs/g' \
			  -e '/^ide-generic/d' \
			  -e '/^ide-disk/d' \
			  -e '/^ext2/d' \
			  -e '/^ext3/d' \
			  /etc/mkinitramfs/modules
		fi

		if [ -e ${RESUME} ]; then
			sed -i -e "s@#RESUME=@RESUME=${RESUME}@" /etc/mkinitramfs/initramfs.conf
		fi

		if [ -e /etc/mkinitrd/DSDT ]; then
			cp /etc/mkinitrd/DSDT /etc/mkinitramfs/DSDT.aml
		fi

	fi
fi

if [ ! -e /etc/mkinitramfs/modules ]; then
	cp /usr/share/doc/initramfs-tools/examples/modules /etc/mkinitramfs/
fi

#DEBHELPER#