11 if [ ! -f $stamp ]; then
15 # compare midnight today to midnight the day the stamp was updated
16 stamp
=$(date --date=$(date -r $stamp --iso-8601) +%s
)
17 now
=$(date --date=$(date --iso-8601) +%s
)
18 delta
=$(($now-$stamp))
19 echo "stamp=$stamp, now=$now, delta=$delta"
21 if [ $delta -ge $interval ]; then
36 DownloadUpgradeableInterval
=0
37 RES
=`apt-config shell UpdateInterval APT::Periodic::Update-Package-Lists DownloadUpgradeableInterval APT::Periodic::Download-Upgradeable-Packages`
40 # laptop check, on_ac_power returns:
41 # 0 (true) System is on mains power
42 # 1 (false) System is not on mains power
43 # 255 (false) Power status could not be determined
44 # Desktop systems always return 255 it seems
45 if which on_ac_power
>/dev
/null
; then
52 UPDATE_STAMP
=/var
/lib
/apt
/periodic
/update
-stamp
53 if check_stamp
$UPDATE_STAMP $UpdateInterval; then
54 if apt
-get -qq update
2>/dev
/null
; then
55 if which dbus
-send >/dev
/null
; then
56 dbus
-send --system / app.apt.dbus.updated boolean
:true
58 update_stamp
$UPDATE_STAMP
62 DOWNLOAD_UPGRADEABLE_STAMP
=/var
/lib
/apt
/periodic
/download
-upgradeable-stamp
63 if check_stamp
$DOWNLOAD_UPGRADEABLE_STAMP $DownloadUpgradeableInterval; then
64 apt
-get -qq -d dist
-upgrade 2>/dev
/null
65 update_stamp
$DOWNLOAD_UPGRADEABLE_STAMP