summaryrefslogtreecommitdiff
path: root/debian/initramfs-tools.postinst
blob: ea9206748733812c8552d6b103daec5875ec0093 (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
#!/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 ${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#