3
# helper for update-motd
7
if [ "$1" = "--force" ]; then
13
# check time when we did the last update check
14
stamp="/var/lib/update-notifier/updates-available"
17
StateDir="/var/lib/apt/"
19
eval "$(apt-config shell StateDir Dir::State)"
20
eval "$(apt-config shell ListDir Dir::State::Lists)"
22
# get dpkg status file
23
DpkgStatus="/var/lib/dpkg/status"
24
eval "$(apt-config shell DpkgStatus Dir::State::status)"
26
# get sources.list file
28
SourceList="sources.list"
29
eval "$(apt-config shell EtcDir Dir::Etc)"
30
eval "$(apt-config shell SourceList Dir::Etc::sourcelist)"
32
# let the actual update be asynchronous to avoid stalling apt-get
33
cleanup() { rm -f "$tmpfile"; }
35
# check if we have a list file or sources.list that needs checking
36
if [ -e "$stamp" ]; then
37
if [ "$(find "/$StateDir/$ListDir" "/$EtcDir/$SourceList" "/$DpkgStatus" -type f -newer "$stamp" -print -quit)" ]; then
41
if [ "$(find "/$StateDir/$ListDir" "/$EtcDir/$SourceList" -type f -print -quit)" ]; then
48
tmpfile=$(mktemp -p $(dirname "$stamp"))
50
# output something for update-motd
51
if [ "$NEED_UPDATE_CHECK" = "yes" ]; then
55
/usr/lib/update-notifier/apt-check --human-readable
58
mv "$tmpfile" "$stamp"