diff --git a/debian/dkms.post_install b/debian/dkms.post_install index 3f9c54fb..f6f2d466 100755 --- a/debian/dkms.post_install +++ b/debian/dkms.post_install @@ -4,16 +4,24 @@ set -e base_dir="${PWD%/*}/$kernelver/$arch/module/arch/arm64/boot/dts" install_dir="/usr/lib/linux-image-$kernelver" -if [[ ! -e "$install_dir/amlogic/overlays" ]] || [[ "$(readlink "$install_dir/amlogic/overlays")" == "$base_dir/amlogic/overlays" ]] && [[ -d "$install_dir/amlogic" ]] -then - echo "Link $base_dir/amlogic/overlays to $install_dir/amlogic/overlays" - rm -f $install_dir/amlogic/overlays - ln -s "$base_dir/amlogic/overlays" "$install_dir/amlogic/overlays" -fi +for vendor in "rockchip" "amlogic" +do + if [[ ! -L "$install_dir/$vendor" ]] && [[ ! -d "$install_dir/$vendor" ]] + then + # Vendor not supported by the kernel + continue + fi -if [[ ! -e "$install_dir/rockchip/overlays" ]] || [[ "$(readlink "$install_dir/rockchip/overlays")" == "$base_dir/rockchip/overlays" ]] && [[ -d "$install_dir/rockchip" ]] -then - echo "Link $base_dir/rockchip/overlays to $install_dir/rockchip/overlays" - rm -f $install_dir/rockchip/overlays - ln -s "$base_dir/rockchip/overlays" "$install_dir/rockchip/overlays" -fi + if [[ -e "$install_dir/$vendor/overlays" ]] && [[ ! -L "$install_dir/$vendor/overlays" ]] + then + # The kernel already comes with overlays. + continue + fi + + if [[ ! "$(readlink "$install_dir/$vendor/overlays")" == "$base_dir/$vendor/overlays" ]] + then + echo "Link $base_dir/$vendor/overlays to $install_dir/$vendor/overlays" + rm -f $install_dir/$vendor/overlays + ln -s "$base_dir/$vendor/overlays" "$install_dir/$vendor/overlays" + fi +done