You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

install_drivers 858B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #! /bin/bash
  2. main() {
  3. drivers_dir=""
  4. while getopts "hd:" arg; do
  5. case "${arg}" in
  6. h)
  7. echo '--help'
  8. ;;
  9. d)
  10. drivers_dir="${OPTARG}"
  11. ;;
  12. *)
  13. echo '??'
  14. ;;
  15. esac
  16. done
  17. shopt -s nullglob
  18. set -e
  19. echo "==== Driver dir: ${drivers_dir}"
  20. for file in "${drivers_dir}"/*; do
  21. echo "==== Processing ${file}..."
  22. case "${file}" in
  23. *.deb)
  24. dpkg -i "${file}" || :
  25. ;;
  26. *.sh)
  27. "${file}"
  28. ;;
  29. *.ppd)
  30. cp "${file}" /usr/share/ppd/
  31. ;;
  32. *)
  33. echo "==== Ignoring ${file}"
  34. ;;
  35. esac
  36. done
  37. if ! apt-get install; then
  38. echo "==== Apt seems broken. Fixing..."
  39. apt-get update &&
  40. DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -yqf &&
  41. apt-get clean &&
  42. rm -rf /var/lib/apt/lists/*
  43. fi
  44. }
  45. main "${@}"