summaryrefslogtreecommitdiff
path: root/arch-linux-rolling/linux-transitional.install
blob: b9c72ea8917df37f49caf6bc797aa7756f974b53 (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
post_install () {
	local kernel_version=${1%.*}
	if [ ! -e /usr/lib/modules/extramodules-$kernel_version-ARCH/version ]; then
		ln -sf /usr/lib/modules/extramodules-$kernel_version-ARCH/version-$1 \
			/usr/lib/modules/extramodules-$kernel_version-ARCH/version
	fi
}

post_upgrade() {
	local new_kernel_version=${1%.*} old_kernel_version=${2%.*}
	local f=/usr/lib/modules/extramodules-$old_kernel_version-ARCH/version
	if [ $new_kernel_version != $old_kernel_version ]; then
		post_remove $2
		post_install $1
	elif [ ! -L $f -a ! -e $f -o "$(readlink $f)" = "$f-$2" ]; then
		# `version` does not exists in any form or is a link to previous kernel
		ln -sf $f-$1 $f
	fi
}

post_remove() {
	local kernel_version=${1%.*}
	if [ "$(readlink /usr/lib/modules/extramodules-$kernel_version-ARCH/version)" = \
			/usr/lib/modules/extramodules-$kernel_version-ARCH/version-$1 ]; then
		rm /usr/lib/modules/extramodules-$kernel_version-ARCH/version
	fi
}