GithubHelp home page GithubHelp logo

Comments (7)

gdraheim avatar gdraheim commented on August 14, 2024

by the way, how to push the directory value as configuration item to the started service? Is there any documentation that %t relates to a standard system configuration value / environment variable? Everybody knows $HOME but what about this one?

from docker-systemctl-replacement.

jamie-at-sas avatar jamie-at-sas commented on August 14, 2024
"%t" Runtime directory root This is either /run (for the system manager) or the path "$XDG_RUNTIME_DIR" resolves to (for user managers).

From this page: systemd.unit

Lots of other % specifiers as well, all listed in a nice table on that page.

from docker-systemctl-replacement.

gdraheim avatar gdraheim commented on August 14, 2024

While checking I had notice that the path itself was wrong ... instead of /run it was targetting /var.

I don't know if that is a good idea as /run may possibly not be present in docker containers.

Another thing is that I have implemented user_mode for the environment variables as well, but the systemd documention is incomplete (again). It just says to use the XDG variables but if you look into that freedesktop standard then applications are asked to assume default values for XDG variables when they are not present. So in user mode, shall systemctl.py fallback to the systemd's system-level values or to freedesktop's user-level values. Hmm.

https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html

from docker-systemctl-replacement.

jamie-at-sas avatar jamie-at-sas commented on August 14, 2024

Containers based on centos, at least, have /var/run -> /run, so either would work. I think most versions of Unix have an equivalent. The only problem is if neither one is there.

To start, I would look for /run. If it exists, use it. If not, look for /var/run. If it exists, use it. If neither one exists... ???

That page seems fairly clear as to how to handle things if the XDG variables are not set, such as

"If $XDG_DATA_HOME is either not set or empty, a default equal to $HOME/.local/share should be used."

There is a phrase like this for each of the variables, stating the default location if the variable isn't set.

I would implement user_mode values based on that page, and cite the link for people to look up the details.

Making your code work to the freedesktop standards is not a bad thing. :-)

from docker-systemctl-replacement.

gdraheim avatar gdraheim commented on August 14, 2024

Well, I know the freedesktop standard but I am unsure if those defaults apply to user-mode of systemctl.py. The systemd's documentation may be read as "if $XDG_xy does exist".

On a second thought I do basically have to make a differentiation here for user-mode. In USERMODE.md I do describe that system-services may also be run in user containers, and the env-vars is a place where I do simply have to check whether the target service as originally meant to be a system-service or user-service. That's the point I was missing here as in the later case it makes fully sense to use XDG defaults and not system defaults.

from docker-systemctl-replacement.

gdraheim avatar gdraheim commented on August 14, 2024

Done the implementation. The test_3260 does also show that %t is expanded differently for --user mode. The %t had been already part of test_3250 for --system mode, with the value corrected.

Please confirm that this fixes your request. :)

from docker-systemctl-replacement.

gdraheim avatar gdraheim commented on August 14, 2024

So far my tests seem to be okay, so I'll keep it that way for the upcoming release 1.4

from docker-systemctl-replacement.

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.