Tow-Boot icon indicating copy to clipboard operation
Tow-Boot copied to clipboard

Podman script addition

Open psstoyanov opened this issue 3 years ago • 7 comments

Basic Podman helpers:

  • [x] Check if base NixOS image is present
  • [x] Check if Volume is present

Can be executed in rootless mode following the Podman docs: https://podman.io/getting-started/installation#linux-distributions

No changes made to the existing Docker script

psstoyanov avatar Sep 02 '22 20:09 psstoyanov

Cleaning up afterwards will be nice but I'm not sure how to do that yet (or re-using the existing container/volume)

psstoyanov avatar Sep 02 '22 20:09 psstoyanov

Cleaning up afterwards will be nice but I'm not sure how to do that yet (or re-using the existing container/volume)

We probably don't want to clean-up, at least not the Nix store volume, as it reduces build time for further invocations. Though it might be relevant to document how to clean it up?

Can someone who knows podman also review and chime in? Thanks!

samueldr avatar Sep 02 '22 20:09 samueldr

What's your reason for making an entirely different script rather than just changing the 2 Docker commands in the existing script? You can just detect if Podman is installed and if so prefer that one, including the extra command to check for existing volumes.

PureTryOut avatar Sep 03 '22 12:09 PureTryOut

@PureTryOut , separating the two at least for now seems like the safest approach. I don't want to break something that is already working. I haven't setup Docker to check if it would work with those changes either.

I don't know how readable it would be to hide what is used behind another variable (or how that var would be named). Although it might have the benefit of passing info to the user early as of what can be used :thinking:

Note: I haven't tried to pass which command to be used for other commands in sh script before.

I'm sure there is more that can be improved but it's a start.

psstoyanov avatar Sep 03 '22 12:09 psstoyanov

Alright, complete revamp of the previous iteration, @samueldr

@PureTryOut - now both docker and podman are used within the same script, I hope this will be satisfactory and easy to read.

Added:

  • [x] Check if the script has been executed as root user
  • [x] Selection between docker && podman
  • [x] Same image && volume commands for docker
  • [x] Errors for the selection
  • [x] Call build.sh script

Things which I'm uncertain if I implemented correctly:

  • [ ] Exit codes
  • [ ] Style of promps

Other:

  • Feedback from other systems (MacOS?) will be good
  • I'm not using docker much so another look there from other users is preferable

Nice to have but most likely for a different PR:

  • [ ] Adding board selection based on the dirs in boards?

psstoyanov avatar Sep 04 '22 18:09 psstoyanov

Sorry it took this long until I could take a look.

I left some notes about the script.

Though it's possible I missed things. Also note I haven't ran it yet.

One main consideration with the script is it should never* stop and ask things. Otherwise it'll differ too greatly from the usual nix-build commands. It should be a drop-in replacement.

*: except maybe for that thing about running as root, I don't know.

samueldr avatar Nov 03 '22 22:11 samueldr

Thank you for the great feedback @samueldr ! I will see to block a few hours on Saturday to go through all the notes.

At the top of my head, perhaps an interactive flag could be a solution. It would allow a flexible route when desired by the user while adhering to the "no-stop to ask" rule as a default.

Most guides for starting with Docker and Podman don't add a mention for rootless mode. Most likely to lower the barrier for entry. Probably a prominent warning that the script is running root mode would be enough.

psstoyanov avatar Nov 03 '22 23:11 psstoyanov