You are not logged in.
Pages: 1
I realize this is a bizarre topic. Bear with me.
Does anyone have, or know of any, script that is designed to take commands like systemctl, and run the real commands? For example, if I run "systemctl start httpd" it will translate it to and execute, "service httpd start."
I think writing such a script, if none exists already, would be easier than trying to patch freeipa to use hard-coded "service httpd start" commands and similar. I started down that route, but some commands include things such as --now and condrestart, which I might need to write a script for, even if it's more basic than a real conditional restart (for which I will have to RTFM to know the condition it depends on).
If nobody has any pointers, I will get started on such a script. I think I'll call it the undiscoverable term "systemdtl," for System Desire to Live. However, I would love to build on somebody else's work should such a thing exist and be suitably licensed.
This space intentionally left blank.
Offline
Please have a look at this:
Offline
Alas, Jesse Smith's fantastic script is not what I'm looking for. I don't need to convert systemd unit files to real init scripts. I want to provide a "systemctl" interface to real commands, so that I don't have to jury-rig a package to use the real commands. The freeipa bits should be able to call "systemctl stop httpd" and the systemctl replacement translates it to "service httpd stop" (or apache2, probably... hm. Save that for version 2).
This space intentionally left blank.
Offline
Write your own wrapper script for the command, perhaps?
Something like this at /usr/local/bin/systemctl:
#!/bin/sh
case "$1" in
start) service "$2" start ;;
stop) service "$2" stop ;;
esac
Last edited by Head_on_a_Stick (2020-01-10 06:02:08)
Brianna Ghey — Rest In Power
Offline
sort of defeats the purpose of being systemd free in a way doesnt it? Would openrc be of any help, its easy enough to create startup scripts for openrc.
https://wiki.gentoo.org/wiki/Join_FreeIPA
Last edited by HevyDevy (2020-01-10 12:29:09)
Offline
@Head_on_a_Stick, yes, basically, I'm going to write a script that does that. I will need to write functionality to handle a few options I see in the freeipa source, like "systemctl --now enable ntp" and so on.
@HevyDevy, well, I really do want to be systemd-free, and if I have to write an interface to let things think they're just calling the systemctl command, I can live with that. I think it's rather pretentious of a package to hard-code in systemctl commands, but seeing as how FreeIPA is built by the Fedora/RHEL people, I can see why they don't bother to look beyond it.
For the longest while, to support my FreeIPA installs, I've just been making an empty systemctl script:
#!/bin/sh
true
But I feel like I can do better.
This space intentionally left blank.
Offline
I realize this is a bizarre topic. Bear with me.
It's not bizarre at all. I think it's a good idea. I had the same idea about two years ago when I was learning how to set up a Debian server.
Phil
Offline
My project is named systemdtl. it provides the /usr/sbin/systemctl script, and also logs the parameters to a logfile so I can learn what more commands it needs to react to.
It is installable from my OBS, and it will pull in dependency bgscripts-core which is in the same OBS repo. I reused my parameter-parsing functions from a library in bgscripts-core instead of using getopts or other.
And after writing my own version, I learn that debian/Devuan packages the systemctl from the docker-systemctl-replacement, However, it appears to actually read the systemd-related files (as in unit files) so it does not do what I want it to do, so I needed to write my version anyway.
This space intentionally left blank.
Offline
Sorry it just reads like a pointless abstraction layer, not your fault of course, you are trying to circumvent systemd pervasiveness in programming. Debian was supposed to be a universal operating system, not a universal init system.
Offline
Yeah, it's for a specific niche almost entirely for me. But I share it freely for anyone else in my situation. I'm definitely not trying to empower systemd; I just want to be able to install freeipa without a million ad-hoc hacks. I'd rather build the hacks into a package and just install it.
I guess version 0.0.2 will include a dummy hostnamectl and systemd-detect-virt based on my current notes for joining a devuan system to a freeipa domain. I guess the virt-what wasn't good enough for the systemd people, so they subsumed that task for themselves.
This space intentionally left blank.
Offline
whether you build a package of hacks or adhock hacks, you are still hacking which later on down the line could present issues, especially with incompatibilities like systemd
Im a firm believer of it must work for the intended operating system without too many indirection's, if not then well look elsewhere.
Last edited by HevyDevy (2020-01-13 15:24:31)
Offline
Nice script! Guess you didn't need my "help" then
Is it simple to output the usage information with a --help option? That would allow you to create a man page with help2man and eliminate one of the Lintian warnings:
W: systemdtl: copyright-has-url-from-dh_make-boilerplate
W: systemdtl: copyright-without-copyright-notice
W: systemdtl: binary-without-manpage usr/sbin/systemctl
It's not important ofc but I do like to shut Lintian up when possible.
Brianna Ghey — Rest In Power
Offline
Ah, I realize the script is complex, and has a dependency, so you probably wouldn't have installed and tried it. The script does output some stuff when you run "sudo systemctl --help." It's hardly a standard GNU coreutil --usage page, but it shows something. And it's my standard boilerplate with only one line added so it's not even demonstrating the correct verbiage.
Would you please file some bugs against the project on gitlab? Otherwise, I'll do it.
And, since you brought up lintian, is there some package I should be using for builds on a Devuan box, so that I don't get this error?
Now running lintian systemdtl_0.0.1-1+devuan_amd64.changes ...
Could not find a profile matching "{VENDOR}/main" for vendor devuan
Lintian::Profile::_find_vendor_profile(Lintian::Profile=HASH(0x55d82ca5b490)) called at /usr/share/perl5/Lintian/Profile.pm line 140
Lintian::Profile::new("Lintian::Profile", undef, ARRAY(0x55d82a4852d0), HASH(0x55d82a7ba3a0)) called at /usr/bin/lintian line 216
dplint::load_profile(undef) called at /usr/share/lintian/commands/lintian.pm line 751
eval {...} called at /usr/share/lintian/commands/lintian.pm line 751
main::main() called at /usr/bin/lintian line 46
eval {...} called at /usr/bin/lintian line 46
main::__ANON__("/usr/share/lintian/commands/lintian.pm") called at /usr/bin/lintian line 115
dplint::run_tool("/usr/bin/lintian", "lintian") called at /usr/bin/lintian line 291
dplint::main() called at /usr/bin/lintian line 375
I already tried
$ apt-file search /usr/share/lintian/profiles/devuan
$
EDIT:
Huh, I found devuan-lintian-profile which adds such a directory. Let me guess, apt-file has a cache that needs to be updated just like apt-file?
Last edited by bgstack15 (2020-01-13 16:48:46)
This space intentionally left blank.
Offline
Also, help2man sounds legit! I have conducted a brief Internet search and don't see any debhelper guidelines for help2man. I found https://salsa.debian.org/reproducible-b … it/075d944 as an example, so it looks like one just uses help2man manually in a Makefile (or perhaps rules)?
Actually, this tool will transform how I write my --help screens... who doesn't want an auto-generated man page?! Regardless of whatever happens with this systemdtl abomination, help2man is a definite positive thing I've learned.
This space intentionally left blank.
Offline
Ah, I realize the script is complex, and has a dependency, so you probably wouldn't have installed and tried it.
Don't tell anybody else but I'm using systemd here so there may be some conflicts...
Would you please file some bugs against the project on gitlab?
Done.
Brianna Ghey — Rest In Power
Offline
Pages: 1