abinfo "Extracting archive"
sh NVIDIA-Linux-$PKGVER.run --extract-only

abinfo "Generating postinst and prerm"
for i in postinst prerm; do
	sed -e "s/@DRV_VER@/${PKGVER}/g" ${SRCDIR}/autobuild/${i}.in > ${SRCDIR}/autobuild/${i}
done

abinfo "Applying patches"
cd "$SRCDIR"/NVIDIA-Linux-x86_64-$PKGVER/
ab_apply_patches "$SRCDIR"/autobuild/patches/*.patch.deferred
