Updates.sh 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. set -e
  3. # run dpkg-reconfigure unattended-upgrades and answer no unattended
  4. echo "Running dpkg-reconfigure unattended-upgrades..."
  5. echo "unattended-upgrades unattended-upgrades/enable_auto_updates boolean false" | sudo debconf-set-selections
  6. sudo dpkg-reconfigure -f noninteractive unattended-upgrades
  7. # mark linux-image-generic and linux-headers-generic as held back
  8. echo "Marking linux-image-generic and linux-headers-generic as held back..."
  9. sudo apt-mark hold linux-image-generic linux-headers-generic
  10. # upgrade the system
  11. echo "Upgrading the system..."
  12. sudo DEBIAN_FRONTEND=noninteractive apt upgrade -y
  13. # Update and install required packages for Active Directory
  14. sudo DEBIAN_FRONTEND=noninteractive apt update
  15. sudo DEBIAN_FRONTEND=noninteractive apt install -y realmd libnss-sss libpam-sss sssd sssd-tools adcli samba-common-bin oddjob oddjob-mkhomedir packagekit
  16. # Install any additional software
  17. # Required packages for Ninja
  18. sudo DEBIAN_FRONTEND=noninteractive apt install -y net-tools network-manager policycoreutils
  19. # Check if reboot is required
  20. if [ -f /var/run/reboot-required ]; then
  21. echo -e "\033[31mA reboot is required.\033[0m"
  22. else
  23. echo -e "\033[32mReboot not required.\033[0m"
  24. fi