Created
March 2, 2011 13:23
-
-
Save jedi4ever/850918 to your computer and use it in GitHub Desktop.
Adapted chef apt default recipe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Adapted because otherwise it will do an update everytime | |
#http://blog.kumina.nl/2010/11/puppet-tipstricks-running-apt-get-update-only-when-needed/ | |
# | |
# Cookbook Name:: apt | |
# Recipe:: default | |
# | |
# Copyright 2008-2009, Opscode, Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://bit.ly/d17eOf | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
# | |
e = execute "apt-get update" do | |
command "/usr/bin/apt-get update && touch /tmp/apt.update" | |
only_if "/bin/sh -c '[ ! -f /tmp/apt.update ] || /usr/bin/find /etc/apt -cnewer /tmp/apt.update | /bin/grep . > /dev/null'" | |
action :nothing | |
end | |
e.run_action(:run) | |
%w{/var/cache/local /var/cache/local/preseeding}.each do |dirname| | |
directory dirname do | |
owner "root" | |
group "root" | |
mode 0755 | |
action :create | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment