From eaad66cd56e5fb4a2c9ada41a440c4e7f6570561 Mon Sep 17 00:00:00 2001 From: CodeChenL <2540735020@qq.com> Date: Tue, 19 Mar 2024 18:38:40 +0800 Subject: [PATCH] fix: dkms.post_remove: optimize code logic --- debian/dkms.post_remove | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/debian/dkms.post_remove b/debian/dkms.post_remove index 2dbbb868..fa06e1c4 100755 --- a/debian/dkms.post_remove +++ b/debian/dkms.post_remove @@ -4,17 +4,14 @@ set -e base_dir="${PWD%/*}/$(uname -r)/$(arch)/module/arch" install_dir="/usr/lib/linux-image-$(uname -r)" -if [[ "$(readlink "$install_dir/amlogic/overlays")" == "$base_dir/arm64/boot/dts/amlogic/overlays" ]] -then - echo "Remove $install_dir/amlogic/overlays" - rm "$install_dir/amlogic/overlays" -fi - -if [[ "$(readlink "$install_dir/rockchip/overlays")" == "$base_dir/arm64/boot/dts/rockchip/overlays" ]] -then - echo "Remove $install_dir/rockchip/overlays" - rm "$install_dir/rockchip/overlays" -fi +for vendor in "rockchip" "amlogic" +do + if [[ "$(readlink "$install_dir/$vendor/overlays")" == "$base_dir/arm64/boot/dts/$vendor/overlays" ]] + then + echo "Remove $install_dir/$vendor/overlays" + rm "$install_dir/$vendor/overlays" + fi +done echo "Remove $base_dir" rm -rf "$base_dir"