function turn_distro_into_esm_mode() {
# guarantee that xenial distro is on ESM mode
lxc exec $name -- sed -i 's/is_esm_supported and is_not_currently_supported/True #comment/' /usr/lib/update-notifier/apt-check
}
function turn_distro_into_non_esm_mode() {
# guarantee that xenial distro is on ESM mode
lxc exec $name -- sed -i 's/True #comment/False/' /usr/lib/update-notifier/apt-check
}
function setup_update_notifier() {
lxc exec $name -- sh -c "cat <<EOF >/etc/apt/sources.list.d/ubuntu-$series-proposed.list
deb http://archive.ubuntu.com/ubuntu/ $series-proposed restricted main multiverse universe"
lxc exec $name -- apt update
lxc exec $name -- sh -c "apt install update-notifier -yq > /dev/null"
}
I can confirm that the xenial, bionic, focal and hirsute packages are working as expected.
To perform the verification I have used the following script:
------- ------- ------- ------- ------- ---
#!/bin/sh
set -x
series=xenial
name=$series-dev
function generate_ motd_message( ) { ------- ------- ------- ------- ------- ------- ------- ----" update- notifier/ update- motd-updates- available --force ------- ------- ------- ------- ------- ------- ------- ----"
message=$1
echo "------
echo $message
lxc exec $name -- /usr/lib/
lxc exec $name -- update-motd
echo "------
}
function turn_distro_ into_esm_ mode() { currently_ supported/ True #comment/' /usr/lib/ update- notifier/ apt-check
# guarantee that xenial distro is on ESM mode
lxc exec $name -- sed -i 's/is_esm_supported and is_not_
}
function turn_distro_ into_non_ esm_mode( ) { update- notifier/ apt-check
# guarantee that xenial distro is on ESM mode
lxc exec $name -- sed -i 's/True #comment/False/' /usr/lib/
}
function setup_update_ notifier( ) { sources. list.d/ ubuntu- $series- proposed. list archive. ubuntu. com/ubuntu/ $series-proposed restricted main multiverse universe"
lxc exec $name -- sh -c "cat <<EOF >/etc/apt/
deb http://
lxc exec $name -- apt update
lxc exec $name -- sh -c "apt install update-notifier -yq > /dev/null"
}
function install_ ua_from_ branch( ) { /github. com/canonical/ ubuntu- advantage- client. git /var/tmp/uac OPTIONS= nocheck dpkg-buildpackage -us -uc > /dev/null" advantage- tools --assume-yes ubuntu- advantage- tools_27. 0_amd64. deb
lxc exec $name --cwd /var/tmp/uac -- apt-get update
lxc exec $name --cwd /var/tmp/uac -- apt-get install make
lxc exec $name -- git clone https:/
lxc exec $name --cwd /var/tmp/uac -- sh -c "make deps > /dev/null"
lxc exec $name --cwd /var/tmp/uac -- sh -c "DEB_BUILD_
lxc exec $name -- apt-get remove ubuntu-
lxc exec $name --cwd /var/tmp/uac -- dpkg -i /var/tmp/
lxc exec $name -- ua version
}
function install_ua() { advantage- tools -y
lxc exec $name -- add-apt-repository ppa:ua-client/daily -y
lxc exec $name -- sudo apt-get update
lxc exec $name -- sudo apt-get install ubuntu-
lxc exec $name -- ua version
lxc exec $name -- sudo apt-get update
}
function ua_disable_ esm_apps( ) {
lxc exec $name -- sudo ua disable esm-apps
}
function install_ all_upgrades( ) {
lxc exec $name -- sudo sh -c "apt update > /dev/null"
lxc exec $name -- sudo sh -c "apt upgrade -y > /dev/null"
}
function ua_attach() { can/contracts. staging. can/' /etc/ubuntu- advantage/ uaclient. conf BEHAVE_ CONTRACT_ TOKEN_STAGING
lxc exec $name -- sed -i 's/contracts.
lxc exec $name -- ua attach $UACLIENT_
}
function ua_detach() {
lxc exec $name -- ua detach --assume-yes
}
function generate_ ua_motd_ messages( ) { ubuntu- advantage/ ua_update_ messaging. py
lxc exec $name -- python3 /usr/lib/
}
function install_ update_ motd() {
lxc exec $name -- apt install update-motd -yq
}
function turn_esm_ apps_into_ non_beta( ) { advantage/ uaclient. conf"
lxc exec $name -- sh -c "echo 'features:\n allow_beta: true' >> /etc/ubuntu-
}
function update_ contract_ effectiveto( ) { date=$( date -d "$date $operation$num_days days" +"%Y-%m- %dT00:00: 00Z")
operation=$1
num_days=$2
replace_
echo $replace_date
lxc exec $name -- sed -i "s/\"effectiveTo\": \"[^\"] *\"/\"effective To\": \"$replace_ date\"/ g" /var/lib/ ubuntu- advantage/ private/ machine- token.json
}
lxc delete --force $name daily:$ series $name
lxc launch ubuntu-
sleep 10
setup_update_ notifier motd_message "$series: ua not installed" apps_into_ non_beta ua_motd_ messages into_esm_ mode motd_message "$series esm: ua not attached" ua_motd_ messages motd_message "$series esm: ua attached" ua_motd_ messages motd_message "$series esm: ua attached, apps disabled" into_non_ esm_mode ua_motd_ messages motd_message "$series non-esm: ua not attached" ua_motd_ messages motd_message "$series non-esm: ua attached" contract_ effectiveto - 30 ua_motd_ messages motd_message "$series esm: ua attached - contract expired" contract_ effectiveto - 5 ua_motd_ messages motd_message "$series esm: ua attached - contract grace period" contract_ effectiveto + 5 ua_motd_ messages motd_message "$series esm: ua attached - contract expire soon" all_upgrades ua_motd_ messages motd_message "$series esm: ua attached - all upgrades installed"
install_update_motd
generate_
install_ua
turn_esm_
generate_
turn_distro_
generate_
ua_attach
generate_
generate_
ua_disable_esm_apps
generate_
generate_
turn_distro_
ua_detach
generate_
generate_
ua_attach
generate_
generate_
update_
generate_
generate_
update_
generate_
generate_
update_
generate_
generate_
install_
generate_
generate_
set +x ------- ------- ------- -
-------
I verified the messages and they are consistent with the modifications delivered by the proposed package