5 # Copyright 2008-2011, Opscode, Inc.
6 # Copyright 2009, Bryan McLellan <btm@loftninjas.org>
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
21 # Run apt-get update to create the stamp file
22 execute "apt-get-update" do
23 command "apt-get update"
25 not_if do ::File.exists?('/var/lib/apt/periodic/update-success-stamp') end
28 # For other recipes to call to force an update
29 execute "apt-get update" do
30 command "apt-get update"
35 # Automatically remove packages that are no longer needed for dependencies
36 execute "apt-get autoremove" do
37 command "apt-get -y autoremove"
41 # Automatically remove .deb files for packages no longer on your system
42 execute "apt-get autoclean" do
43 command "apt-get -y autoclean"
47 # provides /var/lib/apt/periodic/update-success-stamp on apt-get update
48 package "update-notifier-common" do
49 notifies :run, 'execute[apt-get-update]', :immediately
52 execute "apt-get-update-periodic" do
53 command "apt-get update"
56 ::File.exists?('/var/lib/apt/periodic/update-success-stamp') &&
57 ::File.mtime('/var/lib/apt/periodic/update-success-stamp') < Time.now - 86400
61 %w{/var/cache/local /var/cache/local/preseeding}.each do |dirname|