3
# helper for update-motd
7
if [ "$1" = "--force" ]; then
10
if type systemd-detect-virt > /dev/null 2>&1 && systemd-detect-virt -q -c; then
16
# check time when we did the last update check
17
stamp="/var/lib/update-notifier/hwe-eol"
20
StateDir="/var/lib/apt/"
22
eval "$(apt-config shell StateDir Dir::State)"
23
eval "$(apt-config shell ListDir Dir::State::Lists)"
25
# get dpkg status file
26
DpkgStatus="/var/lib/dpkg/status"
27
eval "$(apt-config shell DpkgStatus Dir::State::status)"
29
# get sources.list file
31
SourceList="sources.list"
32
eval "$(apt-config shell EtcDir Dir::Etc)"
33
eval "$(apt-config shell SourceList Dir::Etc::sourcelist)"
35
# let the actual update be asynchronous to avoid stalling apt-get
36
cleanup() { rm -f "$tmpfile"; }
38
# check if we have a list file or sources.list that needs checking
39
if [ -e "$stamp" ]; then
40
if [ "$(find "/$StateDir/$ListDir" "/$EtcDir/$SourceList" "/$DpkgStatus" -type f -newer "$stamp" -print -quit 2> /dev/null)" ]; then
44
if [ "$(find "/$StateDir/$ListDir" "/$EtcDir/$SourceList" -type f -print -quit 2> /dev/null)" ]; then
49
# only print status when running this script as a regular user
50
if [ "$(id -u)" != 0 ] ; then
51
[ "$NEED_EOL_CHECK" = "no" ] || /usr/bin/hwe-support-status || true
57
tmpfile=$(mktemp -p $(dirname "$stamp"))
59
# output something for update-motd
60
if [ "$NEED_EOL_CHECK" = "yes" ]; then
62
# the script may exit with status 10 when a HWE update is needed
63
/usr/bin/hwe-support-status || true
65
mv "$tmpfile" "$stamp"
68
# output what we have (either cached or newly generated)