Skip to content

Instantly share code, notes, and snippets.

@jedi4ever
Created March 2, 2011 13:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedi4ever/850918 to your computer and use it in GitHub Desktop.
Save jedi4ever/850918 to your computer and use it in GitHub Desktop.
Adapted chef apt default recipe
# 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