11 if [ $interval -eq 0 ]; then
15 if [ ! -f $stamp ]; then
19 # compare midnight today to midnight the day the stamp was updated
20 stamp
=$(date --date=$(date -r $stamp --iso-8601) +%s
)
21 now
=$(date --date=$(date --iso-8601) +%s
)
22 delta
=$(($now-$stamp))
24 if [ $delta -ge $interval ]; then
39 DownloadUpgradeableInterval
=0
40 eval $(apt-config shell UpdateInterval APT::Periodic::Update-Package-Lists DownloadUpgradeableInterval APT::Periodic::Download-Upgradeable-Packages)
41 AutocleanInterval
=$DownloadUpgradeableInterval
42 eval $(apt-config shell AutocleanInterval APT::Periodic::Autoclean)
44 # laptop check, on_ac_power returns:
45 # 0 (true) System is on mains power
46 # 1 (false) System is not on mains power
47 # 255 (false) Power status could not be determined
48 # Desktop systems always return 255 it seems
49 if which on_ac_power
>/dev
/null
; then
56 UPDATE_STAMP
=/var
/lib
/apt
/periodic
/update
-stamp
57 if check_stamp
$UPDATE_STAMP $UpdateInterval; then
58 if apt
-get -qq update
2>/dev
/null
; then
59 if which dbus
-send >/dev
/null
; then
60 dbus
-send --system / app.apt.dbus.updated boolean
:true
62 update_stamp
$UPDATE_STAMP
66 DOWNLOAD_UPGRADEABLE_STAMP
=/var
/lib
/apt
/periodic
/download
-upgradeable-stamp
67 if check_stamp
$DOWNLOAD_UPGRADEABLE_STAMP $DownloadUpgradeableInterval; then
68 apt
-get -qq -d dist
-upgrade 2>/dev
/null
69 update_stamp
$DOWNLOAD_UPGRADEABLE_STAMP
72 AUTOCLEAN_STAMP
=/var
/lib
/apt
/periodic
/autoclean
-stamp
73 if check_stamp
$AUTOCLEAN_STAMP $AutocleanInterval; then
75 update_stamp
$AUTOCLEAN_STAMP