uninstall.sh 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #!/bin/bash
  2. if [[ $EUID -ne 0 ]]; then
  3. echo "This script must be run as root (use sudo)" 1>&2
  4. exit 1
  5. fi
  6. is_Raspberry=$(cat /proc/device-tree/model | awk '{print $1}')
  7. if [ "x${is_Raspberry}" != "xRaspberry" ] ; then
  8. echo "Sorry, this drivers only works on raspberry pi"
  9. exit 1
  10. fi
  11. uname_r=$(uname -r)
  12. echo "remove dtbos"
  13. rm /boot/overlays/wm8960-soundcard.dtbo || true
  14. sed -i '/dtoverlay=wm8960-soundcard/d' /boot/config.txt
  15. echo "remove alsa configs"
  16. rm -rf /etc/wm8960-soundcard/ || true
  17. echo "disabled service "
  18. systemctl disable wm8960-soundcard.service
  19. echo "remove wm8960-soundcard"
  20. rm /usr/bin/wm8960-soundcard || true
  21. rm /lib/systemd/system/wm8960-soundcard.service || true
  22. echo "remove dkms"
  23. dkms remove wm8960-soundcard/1.0 --all
  24. rm -rf /var/lib/dkms/wm8960-soundcard || true
  25. echo "remove kernel modules"
  26. rm /lib/modules/${uname_r}/kernel/sound/soc/codecs/snd-soc-wm8960.ko || true
  27. rm /lib/modules/${uname_r}/kernel/sound/soc/codecs/snd-soc-wm8960-soundcard.ko || true
  28. sed -i '/snd-soc-wm8960/d' /etc/modules
  29. sed -i '/snd-soc-wm8960-soundcard/d' /etc/modules
  30. echo "------------------------------------------------------"
  31. echo "Please reboot your raspberry pi to apply all settings"
  32. echo "Thank you!"
  33. echo "------------------------------------------------------"