Current Path : /usr/lib/update-notifier/ |
Current File : //usr/lib/update-notifier/update-motd-hwe-eol |
#!/bin/sh -e # # helper for update-motd # poor mans force if [ "$1" = "--force" ]; then NEED_EOL_CHECK=yes fi # check time when we did the last update check stamp="/var/lib/update-notifier/hwe-eol" # get list dir StateDir="/var/lib/apt/" ListDir="lists/" eval "$(apt-config shell StateDir Dir::State)" eval "$(apt-config shell ListDir Dir::State::Lists)" # get sources.list file EtcDir="etc/apt/" SourceList="sources.list" eval "$(apt-config shell EtcDir Dir::Etc)" eval "$(apt-config shell SourceList Dir::Etc::sourcelist)" # dpkg status dir DpkgStatusDir="etc/apt/" eval "$(apt-config shell DpkgStatusDir Dir::State::status)" # check if we have a list file or sources.list that needs checking if [ -e "$stamp" ]; then if [ "$(find "/$DpkgStatusDir" "/$StateDir/$ListDir" "/$EtcDir/$SourceList" -type f -newer "$stamp" -print -quit)" ]; then NEED_EOL_CHECK=yes fi else if [ "$(find "/$StateDir/$ListDir" "/$EtcDir/$SourceList" -type f -print -quit)" ]; then NEED_EOL_CHECK=yes fi fi # output something for update-motd if [ -n "$NEED_EOL_CHECK" ]; then # preserve mtime to avoid race when script runs while dpkg runs touch ${stamp}.started { echo "" # the script may exit with status 10 when a HWE update is needed /usr/bin/hwe-support-status || true echo "" } > $stamp touch -r ${stamp}.started $stamp rm -f ${stamp}.started fi # output what we have (either cached or newly generated) cat "$stamp"