blob: d92ccf5dc74883e57abe1e22d430e992fe1bc11f [file] [log] [blame]
#!/bin/sh
# Copyright 2019 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Upgrades a Crostini container from Debian Stretch to Buster,
# expects to be run as root.
set -ex
# Use defaults for everything, we don't support answering prompts.
export DEBIAN_FRONTEND=noninteractive
# No longer need to backport GPU support packages.
rm -f /etc/apt/sources.list.d/cros-gpu.list \
/etc/apt/preferences.d/cros-gpu.pref
# Make sure apt-keys are up to date. We don't use keyring.debian.org because it
# only serves debian-specific keys and that's not enough when we want the
# Google package signing key. however most people don't need this so ignore
# failures.
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --batch \
--refresh-keys --keyserver keyserver.ubuntu.com \
EB4C1BFD4F042F6DDDCCEC917721F63BD38B4796 || true
# The actual flip to buster.
sed -i 's/stretch/buster/g' /etc/apt/sources.list \
/etc/apt/sources.list.d/cros.list
# When conflicting configuration files exist between the local system and the
# upstream package, prefer the default option. If there is no default option,
# default to keeping the local version. This is required along with setting
# DEBIAN_FRONTEND above for a truly noninteractive upgrade experience.
APT_OPTIONS="-o Dpkg::Options::=--force-confdef
-o Dpkg::Options::=--force-confold"
# Upgrade everything to Buster versions.
apt-get ${APT_OPTIONS} update -y
apt-get ${APT_OPTIONS} upgrade -y
apt-get ${APT_OPTIONS} dist-upgrade -y