Skip to content

Instantly share code, notes, and snippets.

@miketheman
Created August 27, 2013 13:38
Show Gist options
  • Save miketheman/6353617 to your computer and use it in GitHub Desktop.
Save miketheman/6353617 to your computer and use it in GitHub Desktop.
fragment for dealing with S3 and plus sign in URLs. Part of a bigger tool that will be open-sourced at some point.
# S3 translates a '+' in filenames to %2B in the URL, breaking apt
# Here we will traverse any file in the pool/ dir and create a hardlink for
# any file that has a plus in its name. apt/wget will do the right thing.
Dir.chdir('<%= @repo_root %>') do
plusfiles = Dir.glob '**/*/*+*.deb'
begin
plusfiles.each do |file|
File.link(file, file.gsub('+', ' '))
end
rescue SystemCallError # swallow this if file already exists
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment