Merge lp:~andersk/update-notifier/lp1200044 into lp:update-notifier/ubuntu

Proposed by Anders Kaseorg
Status: Merged
Merged at revision: 813
Proposed branch: lp:~andersk/update-notifier/lp1200044
Merge into: lp:update-notifier/ubuntu
Diff against target: 66 lines (+14/-30)
1 file modified
data/update-motd-updates-available (+14/-30)
To merge this branch: bzr merge lp:~andersk/update-notifier/lp1200044
Reviewer Review Type Date Requested Status
Michael Vogt Pending
Ubuntu Core Development Team Pending
Review via email: mp+174093@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

On Thu, Jul 11, 2013 at 02:01:24AM -0000, Anders Kaseorg wrote:
> You have been requested to review the proposed merge of lp:~anders-kaseorg/update-notifier/lp1200044 into lp:update-notifier.
>
> For more details, see:
> https://code.launchpad.net/~anders-kaseorg/update-notifier/lp1200044/+merge/174093

Thanks for your merge proposal. This looks good, +1 from me.

Cheers,
 Michael

>
> --
> https://code.launchpad.net/~anders-kaseorg/update-notifier/lp1200044/+merge/174093
> You are requested to review the proposed merge of lp:~anders-kaseorg/update-notifier/lp1200044 into lp:update-notifier.

> === modified file 'data/update-motd-updates-available'
> --- data/update-motd-updates-available 2009-07-13 16:14:27 +0000
> +++ data/update-motd-updates-available 2013-07-11 01:59:28 +0000
> @@ -8,48 +8,32 @@
> NEED_UPDATE_CHECK=yes
> fi
>
> -# check time when we did the last udpate check
> +# check time when we did the last update 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
> +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)
> -if [ $(stat -c %Y "/$EtcDir/$SourceList") -gt $stampt ]; then
> +eval "$(apt-config shell EtcDir Dir::Etc)"
> +eval "$(apt-config shell SourceList Dir::Etc::sourcelist)"
> +
> +# check if we have a list file or sources.list that needs checking
> +if [ "$(find "/$StateDir/$ListDir" "/$EtcDir/$SourceList" -type f -newer "$stamp" -print -quit)" ]; 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
> + 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
> +cat "$stamp"
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/update-motd-updates-available'
2--- data/update-motd-updates-available 2009-07-13 16:14:27 +0000
3+++ data/update-motd-updates-available 2013-07-11 01:59:28 +0000
4@@ -8,48 +8,32 @@
5 NEED_UPDATE_CHECK=yes
6 fi
7
8-# check time when we did the last udpate check
9+# check time when we did the last update check
10 stamp="/var/lib/update-notifier/updates-available"
11-if [ -e "$stamp" ]; then
12- stampt=$(stat -c %Y $stamp)
13-else
14- stampt=0
15-fi
16
17 # get list dir
18 StateDir="/var/lib/apt/"
19 ListDir="lists/"
20-eval $(apt-config shell StateDir Dir::State)
21-eval $(apt-config shell ListDir Dir::State::Lists)
22-
23-# check if we have a list file that needs checking
24-d="/$StateDir/$ListDir"
25-for f in $d/*; do
26- # ignore dirs
27- if [ ! -f $f ]; then
28- continue
29- fi
30- t=$(stat -c %Y $f)
31- if [ $t -gt $stampt ]; then
32- NEED_UPDATE_CHECK=yes
33- fi
34-done
35-
36-# check if sources.list was modified since last check
37+eval "$(apt-config shell StateDir Dir::State)"
38+eval "$(apt-config shell ListDir Dir::State::Lists)"
39+
40+# get sources.list file
41 EtcDir="etc/apt/"
42 SourceList="sources.list"
43-eval $(apt-config shell EtcDir Dir::Etc)
44-eval $(apt-config shell SourceList Dir::Etc::sourcelist)
45-if [ $(stat -c %Y "/$EtcDir/$SourceList") -gt $stampt ]; then
46+eval "$(apt-config shell EtcDir Dir::Etc)"
47+eval "$(apt-config shell SourceList Dir::Etc::sourcelist)"
48+
49+# check if we have a list file or sources.list that needs checking
50+if [ "$(find "/$StateDir/$ListDir" "/$EtcDir/$SourceList" -type f -newer "$stamp" -print -quit)" ]; then
51 NEED_UPDATE_CHECK=yes
52 fi
53
54 # output something for update-motd
55 if [ -n "$NEED_UPDATE_CHECK" ]; then
56- echo "" > $stamp
57- /usr/lib/update-notifier/apt-check --human-readable >> $stamp
58- echo "" >> $stamp
59+ echo "" > "$stamp"
60+ /usr/lib/update-notifier/apt-check --human-readable >> "$stamp"
61+ echo "" >> "$stamp"
62 fi
63
64 # output what we have (either cached or newly generated)
65-cat $stamp
66+cat "$stamp"

Subscribers

People subscribed via source and target branches

to all changes: