aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/config-blacklist-module.sh
blob: 4af599d2a2b00587ba23b7f37c4a56f7d7b0c691 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

image="$1"
module="$2"

if test "$image" = ""; then
	echo "usage: $0 <image> <module>"
	exit 1
fi

if virt-cat -a "$image" /etc/grub2-efi.cfg >/dev/null; then
	bootedit="/etc/grub2-efi.cfg:s/linuxefi/linuxefi rd.driver.blacklist=${module}/"
else
	bootedit="/boot/extlinux/extlinux.conf:s/append/append rd.driver.blacklist=${module}/"
fi

set -ex
virt-customize -a "$image" --no-network \
	--edit "$bootedit" \
	--write "/etc/modprobe.d/blacklist-${module}.conf:blacklist ${module}"