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
}
I have tested this package for released xenial, bionic, focal and hirsute with the following script:
------- ------- ------- -
#!/bin/sh
set -x
series=hirsute
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( ) { update- notifier- test-ppa -y notifier- common -y lib/update- notifier/ apt-check sources. list.d/ ubuntu- $series- proposed. list archive. ubuntu. com/ubuntu/ $series-proposed restricted main multiverse universe"
# lxc exec $name -- add-apt-repository ppa:lamoura/
# lxc exec $name -- apt update
# lxc exec $name -- apt install update-
# lxc exec $name -- apt update
# lxc exec $name -- apt install python3-distro-info
# lxc file push data/apt_check.py $name/usr/
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() { 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_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" 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"
install_update_motd
generate_
install_ua
turn_esm_
generate_
turn_distro_
generate_
ua_attach
generate_
generate_
turn_distro_
ua_detach
generate_
generate_
ua_attach
generate_
generate_
update_
generate_
generate_
update_
generate_
generate_
update_
generate_
generate_
set +x ------- ------- ----
-------
I can confirm that on all release, the package now in proposed is working as expected