File: kernel-postrm-delete-initrd

package info (click to toggle)
makedumpfile 1%3A1.6.5-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,268 kB
  • sloc: ansic: 22,154; sh: 1,028; perl: 149; makefile: 127
file content (31 lines) | stat: -rwxr-xr-x 720 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
#!/bin/sh -e

version="$1"
kdumpdir="/var/lib/kdump"

[ -x /usr/sbin/update-initramfs ] || exit 0

# passing the kernel version is required
if [ -z "${version}" ]; then
	echo >&2 "W: kdump-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kernel package} did not pass a version number"
	exit 0
fi

# exit if custom kernel does not need an initramfs
if [ "$INITRD" = 'No' ]; then
	exit 0
fi

# avoid running multiple times
if [ -n "$DEB_MAINT_PARAMS" ]; then
	eval set -- "$DEB_MAINT_PARAMS"
	if [ -z "$1" ] || [ "$1" != "remove" ]; then
		exit 0
	fi
fi

# delete initramfs
echo "kdump-tools: Removing $kdumpdir/initrd.img-${version}"
if [ -e "$kdumpdir/initrd.img-${version}" ];then
	rm -f "$kdumpdir/initrd.img-${version}" || true
fi