_apt.rb 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #
  2. # Cookbook:: workstation
  3. # Recipe:: _apt
  4. #
  5. # Copyright:: 2022, The Authors, All Rights Reserved.
  6. file '/etc/apt/sources.list' do
  7. action :delete
  8. end
  9. components_ = %w[main contrib non-free]
  10. # Main distribution
  11. apt_repository 'debian_testing' do
  12. arch 'amd64'
  13. uri 'http://deb.debian.org/debian/'
  14. distribution 'testing'
  15. components components_
  16. deb_src true
  17. action :add
  18. notifies :run, 'execute[UpdateDistribution]', :immediately
  19. end
  20. apt_repository 'debian_testing_updates' do
  21. arch 'amd64'
  22. uri 'http://deb.debian.org/debian/'
  23. distribution 'testing-updates'
  24. components components_
  25. deb_src true
  26. action :add
  27. end
  28. apt_repository 'debian_testing_security' do
  29. arch 'amd64'
  30. uri 'http://deb.debian.org/debian-security'
  31. distribution 'testing-security'
  32. components components_
  33. deb_src true
  34. action :add
  35. end
  36. apt_repository 'debian_testing_proposed_updates' do
  37. arch 'amd64'
  38. uri 'http://deb.debian.org/debian/'
  39. distribution 'testing-proposed-updates'
  40. components components_
  41. deb_src true
  42. action :add
  43. end
  44. # Stable in case package not found in testing
  45. apt_repository 'debian_stable' do
  46. arch 'amd64'
  47. uri 'http://deb.debian.org/debian/'
  48. distribution 'stable'
  49. components components_
  50. deb_src true
  51. action :add
  52. end
  53. # Apt configuration
  54. file '/etc/apt/apt.conf.d/01norecommend' do
  55. owner 'root'
  56. group 'root'
  57. mode '0644'
  58. content <<-_EOF.gsub(/^\s+/, '')
  59. APT::Install-Recommends "0";
  60. APT::Install-Suggests "0";
  61. _EOF
  62. end
  63. execute 'UpdateDistribution' do
  64. command '/usr/bin/apt-get dist-upgrade -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"'
  65. environment ({ 'DEBIAN_FRONTEND' => 'noninteractive' })
  66. action :nothing
  67. end