Skip to content

Instantly share code, notes, and snippets.

@martinisoft
Last active August 29, 2015 14:04
Show Gist options
  • Save martinisoft/baf030f286d9616cc928 to your computer and use it in GitHub Desktop.
Save martinisoft/baf030f286d9616cc928 to your computer and use it in GitHub Desktop.
Ugly Chef hackery
# The problem: I've got to swap the apt mirror out (idempotently) and update apt
# BEFORE build-essential triggers at compile time. Hence the run_action trick
# to force the resource to trigger at compile time, not run time.
#
# Why? Old Ubuntu release apt mirrors get retired to old-releases.ubuntu.com
if node['platform_version'].to_f == 13.04
execute "swap in old release mirror" do
user 'root'
command "/bin/sed -i -e 's#http:\/\/.*.ubuntu.com#http:\/\/old-releases.ubuntu.com#g' /etc/apt/sources.list && apt-get update"
not_if "grep 'old-releases.ubuntu.com' /etc/apt/sources.list"
action :nothing
end.run_action(:run)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment