3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 export DEBIAN_FRONTEND
=noninteractive
17 ubuntu_version
="`lsb_release -r | awk '{print $2}'`";
18 major_version
="`echo $ubuntu_version | awk -F. '{print $1}'`";
20 # Disable release-upgrades
21 sed -i.bak
's/^Prompt=.*$/Prompt=never/' /etc
/update-manager
/release-upgrades
;
23 # Disable systemd apt timers/services
24 if [ "$major_version" -ge "16" ]; then
25 systemctl stop apt-daily.timer
;
26 systemctl stop apt-daily-upgrade.timer
;
27 systemctl disable apt-daily.timer
;
28 systemctl disable apt-daily-upgrade.timer
;
29 systemctl mask apt-daily.service
;
30 systemctl mask apt-daily-upgrade.service
;
31 systemctl daemon-reload
;
34 # Disable periodic activities of apt to be safe
35 cat <<EOF >/etc/apt/apt.conf.d/10periodic;
36 APT::Periodic::Enable "0";
37 APT::Periodic::Update-Package-Lists "0";
38 APT::Periodic::Download-Upgradeable-Packages "0";
39 APT::Periodic::AutocleanInterval "0";
40 APT::Periodic::Unattended-Upgrade "0";
43 # Clean and nuke the package from orbit
44 rm -rf /var
/log
/unattended-upgrades
;
45 apt-get
-y purge unattended-upgrades
;
47 # Update the package list
50 # Upgrade all installed packages
51 #DEBIAN_FRONTEND=noninteractive sudo apt-get -y upgrade;
53 # Upgrade all installed packages incl. kernel and kernel headers
54 apt-get
-y dist-upgrade
-o Dpkg
::Options
::="--force-confnew";