-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable packaging of curl|bash and other wild stuff. #1957
base: main
Are you sure you want to change the base?
Conversation
I picked Podman to start with because that's what I have right now. Here's converting The rustup docs say the following:
🫡 We've got an rpm. Let's try it.
Cool, eh? Let's try running rustc?
|
I was originally using tar's --exclude (didn't get committed), but '--exclude tmp' will exclude any path with "tmp" in the name when I really want to exclude just the toplevel directory "/tmp". Then I rememered fpm has its own --exclude which is based on Ruby's File::fnmatch, and that works differently than tar's --exclude and also does what I want. This bug was found by trying to package sdkman: ``` % bundle exec bin/fpm --verbose -f -s curlbash -t rpm -n sdkman \ --depends zip --depends unzip \ --curlbash-setup "apt-get update" \ --curlbash-setup "apt-get install -y curl unzip zip" 'curl -s "https://get.sdkman.io?rcupdate=false" | bash' ```
sdkman --
And installing it...
👍 |
Heh, what if we package what sdkman does instead?
|
Chef's installer
|
Trying ohmyzsh:
|
Trying nodesource. This script seems to add a apt repository on Ubuntu then offers
This is fun because it actually captures the nodejs install instead of just updating your apt repos.
|
It's not perfect, but it is funny :) |
I found that sometimes fpm would crash during the cleanup step because some directories had their write permission removed. I'm rather surprised I don't remember seeing this problem in the past, though it's possible my memory is bad and I just forget having experienced this. The solution I came up with is to ensure all directories have both execute and write permissions before attempting `Fileutils.rm_r` As a cheat, I reuse a FileUtils internal class (`FileUtils::Entry_`) and its `preorder_traversal` methods to walk all directories, ensuring that top-level and parent directories are modified first. I know it's taboo to use internal/non-public code. It works on Ruby 2.7, and if we need to change implementations to make things work better on other rubies, then we'll do that. It works.
Example: ``` FROM fedora:36 RUN ls RUN touch /usr/bin/hello-world ``` ``` % bundle exec bin/fpm -f -s curlbash -t rpm -n example /tmp/Dockerfile Created package {:path=>"example-1.0-1.x86_64.rpm"} % rpm -qlvp example-1.0-1.x86_64.rpm -rw-r--r-- 1 root root 0 Nov 12 21:43 /usr/bin/hello-world ```
Added Dockerfile/Containerfile support |
Also added some scaffholding for docker support whenever that gets added to fpm.
and also fixed bugs found by the tests. :)
Also ensure we clean up the temporary container image we created
I feel like this better suits the purpose, as we could curlbash things but this feature can also just do regular Dockerfile/Containerfile things.
For #1853
References: https://gist.github.com/jordansissel/0e0fc22344a17eadd1a3b9a1bbb7ed60
Attempts that worked out well enough:
sdk install java