Code Monkey home page Code Monkey logo

Comments (4)

anhvoms avatar anhvoms commented on July 3, 2024

I prefer keeping the distro-specific functionality instead of a lot if/else. I.e., if this tool exists, use it, otherwise use the other tool. Additionally, a tool exists in the image doesn't mean that it's the preferred tool to use for that distro. As we started adding functionality beyond hostname/username, the difference in handling each distro will start growing.

We can solve the issue of "most distros don't work" by having a generic distro.

from azure-init.

t-lo avatar t-lo commented on July 3, 2024

An alternative to run-time detection would be build-time switches, i.e. give the packagers control over what tools they prefer.

from azure-init.

pothos avatar pothos commented on July 3, 2024

An alternative to run-time detection would be build-time switches, i.e. give the packagers control over what tools they prefer.

That's what Ignition does, one can tell it to run a certain binary for user adding, be it due to having a different path or because it's another tool (as long as the basic arguments are compatible). When multiple tools are supported with different arguments it's even stronger, but I would also keep the custom path setting in mind to make life easier when distros switch from sbin to bin and similar.

from azure-init.

dongsupark avatar dongsupark commented on July 3, 2024

Rust supports a custom build-time environment variable via rustc-env, which can be configured in build.rs, a custom build script. Then each environment variable can be consumed by env! in the compiled macro. For example, see sudo-rs. That looks more or less like what ignition does like Kai said, not in Go but in Rust.

If we also want to make it possible to configure at runtime, the most wide-spread way is to use clap, which supports command-line options coupled with environment variables.

Anyway I agree that we should remove distro-specific checks in the code.

I will soon try to come up with a draft PR.

from azure-init.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.