summarylogtreecommitdiffstats
path: root/phc-k8.install
blob: 0e176f1e0a852f3b27f10d9282d0967c4313b6e2 (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
post_install() {
	cat <<-EOF
		You can enter the desired voltage IDs in /etc/default/phc-k8.
		Booting with nophc kernel parameter skips setting of VIDs in case of failure.
	EOF
}

pre_upgrade() {
	if (( "$(vercmp $2 0.4.6-2)" < 0 )); then
		cd usr/lib/modules/
		for i in *; do
			if [ -f "$i/extramodules/phc-k8.ko" ]; then
				rm -f "$i"/extramodules/{mperf,phc-k8}.ko
				[ -d "$i/kernel" ] && depmod "$i"
			elif [ -f "$i/phc-k8.ko" ]; then
				rm -f "$i"/{mperf,phc-k8}.ko
				rmdir -p --ignore-fail-on-non-empty "$i"
			elif [ -d "$i/updates/kernel/arch/x86/kernel/cpu/cpufreq" ]; then
				rm -f "$i"/updates/kernel/arch/x86/kernel/cpu/cpufreq/{mperf,phc-k8}.ko
				rmdir -p --ignore-fail-on-non-empty "$i/updates/kernel/arch/x86/kernel/cpu/cpufreq"
				[ -d "$i/kernel" ] && depmod "$i"
			fi
		done
	fi
}

post_upgrade() {
	if (( "$(vercmp $2 0.4.6-2)" < 0 )); then
		rm -rf usr/src/phc-k8/
		echo '===> The kernel module gets automatically built by DKMS now.'
	fi
}