Current Path : /usr/lib/update-notifier/ |
Current File : //usr/lib/update-notifier/update-motd-updates-available |
#!/bin/sh -e # # helper for update-motd # poor mans force if [ "$1" = "--force" ]; then NEED_UPDATE_CHECK=yes fi # check time when we did the last udpate check stamp="/var/lib/update-notifier/updates-available" if [ -e "$stamp" ]; then stampt=$(stat -c %Y $stamp) else stampt=0 fi # get list dir StateDir="/var/lib/apt/" ListDir="lists/" eval $(apt-config shell StateDir Dir::State) eval $(apt-config shell ListDir Dir::State::Lists) # check if we have a list file that needs checking d="/$StateDir/$ListDir" for f in $d/*; do # ignore dirs if [ ! -f $f ]; then continue fi t=$(stat -c %Y $f) if [ $t -gt $stampt ]; then NEED_UPDATE_CHECK=yes fi done # check if sources.list was modified since last check EtcDir="etc/apt/" SourceList="sources.list" eval $(apt-config shell EtcDir Dir::Etc) eval $(apt-config shell SourceList Dir::Etc::sourcelist) if [ $(stat -c %Y "/$EtcDir/$SourceList") -gt $stampt ]; then NEED_UPDATE_CHECK=yes fi # output something for update-motd if [ -n "$NEED_UPDATE_CHECK" ]; then echo "" > $stamp /usr/lib/update-notifier/apt-check --human-readable >> $stamp echo "" >> $stamp fi # output what we have (either cached or newly generated) cat $stamp