diff --git a/debian/ubuntu-advantage-tools.postinst b/debian/ubuntu-advantage-tools.postinst index 68636b59e4..f803ddfda1 100644 --- a/debian/ubuntu-advantage-tools.postinst +++ b/debian/ubuntu-advantage-tools.postinst @@ -476,7 +476,7 @@ case "$1" in fi if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "31~"; then - /usr/lib/ubuntu-advantage/postinst-migrations.sh $PREVIOUS_PKG_VER + /usr/lib/ubuntu-advantage/postinst-migrations.sh $PREVIOUS_PKG_VER $VERSION_ID fi ;; esac diff --git a/debian/ubuntu-pro-client.postinst b/debian/ubuntu-pro-client.postinst index 25c3dac2e7..018a894ad0 100644 --- a/debian/ubuntu-pro-client.postinst +++ b/debian/ubuntu-pro-client.postinst @@ -53,7 +53,7 @@ case "$1" in # if dpkg --compare-versions "$PREVIOUS_PKG_VER" ge "31~"; then - /usr/lib/ubuntu-advantage/postinst-migrations.sh $PREVIOUS_PKG_VER + /usr/lib/ubuntu-advantage/postinst-migrations.sh $PREVIOUS_PKG_VER $VERSION_ID fi # diff --git a/lib/postinst-migrations.sh b/lib/postinst-migrations.sh index a5a8bf3e97..06e91f21e6 100755 --- a/lib/postinst-migrations.sh +++ b/lib/postinst-migrations.sh @@ -45,6 +45,7 @@ set -e PREVIOUS_PKG_VER=$1 +UBUNTU_RELEASE=$2 if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "32~"; then # When we perform the write operation through @@ -86,5 +87,15 @@ if dpkg --compare-versions "$PREVIOUS_PKG_VER" lt "35~"; then # is updated to include the snapshot urls for esm-infra and esm-apps if [ -f "/var/lib/ubuntu-advantage/private/machine-token.json" ]; then /usr/bin/python3 /usr/lib/ubuntu-advantage/add_esm_snapshot_auth.py + + # On Focal and Jammy, the CIS service transitioned to USG from v35 + # This changes the lists and authentication files to represent that + # in case CIS is enabled + if [ "$UBUNTU_RELEASE" = "20.04" ] || [ "$UBUNTU_RELEASE" = "22.04" ]; then + if [ -f /etc/apt/sources.list.d/ubuntu-cis.list ]; then + mv /etc/apt/sources.list.d/ubuntu-cis.list /etc/apt/sources.list.d/ubuntu-usg.list + sed -i 's#/cis/ubuntu#/usg/ubuntu#' /etc/apt/sources.list.d/ubuntu-usg.list + sed -i 's#/cis/ubuntu#/usg/ubuntu#' /etc/apt/auth.conf.d/90ubuntu-advantage + fi fi fi