Skip to content
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

systemd unit #20

Open
rathann opened this issue Mar 22, 2021 · 13 comments
Open

systemd unit #20

rathann opened this issue Mar 22, 2021 · 13 comments

Comments

@rathann
Copy link

rathann commented Mar 22, 2021

Would you consider adding a simple systemd unit, e.g.:

[Unit]
Description=Activate Windows Logical Disk Manager volumes
Documentation=man:ldmtool(1)

[Service]
ExecStart=/usr/bin/ldmtool create all
ExecStop=/usr/bin/ldmtool remove all
Type=oneshot
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

This would allow adding LDM mounts to fstab, e.g.:

/dev/mapper/ldm_vol_LOCALHOST-Dg0_Volume1 /mnt/windata ntfs defaults,rw,x-systemd.requires=ldm.service 0 0
@rwmjones
Copy link
Collaborator

I guess so. I tried to use autoconf to substitute the correct @bindir@ but it insists on putting ${exec_prefix} into the path for spurious reasons. Do you have a suggested patch?

@rathann
Copy link
Author

rathann commented Mar 22, 2021

No patch, sorry. But if you post your not-exactly-working one, I could take a look and maybe fix it.

@rwmjones
Copy link
Collaborator

Sure, it's completely wrong though: http://oirase.annexia.org/tmp/0001-Add-example-systemd-unit-file.patch.txt

@rathann
Copy link
Author

rathann commented Mar 23, 2021

Not sure what you mean by completely wrong, it works just fine for me. The unit file generated by configure has /usr/bin/ldmtool in it.

@rwmjones
Copy link
Collaborator

For me it has:

[Service]
ExecStart=${exec_prefix}/bin/ldmtool create all
ExecStop=${exec_prefix}/bin/ldmtool remove all

@rathann
Copy link
Author

rathann commented Mar 23, 2021

Which distro? I was testing on F33.

@rathann
Copy link
Author

rathann commented Mar 24, 2021

Even on rawhide, the resulting unit file contains /usr/bin/ldmtool. I did both tests in mock, so I'm not sure why you're seeing different results.

@rathann
Copy link
Author

rathann commented Mar 24, 2021

Here's my patch for Fedora package that I used for testing:
0001-New-upstream-version-0.2.5.patch.txt

@rwmjones
Copy link
Collaborator

It still has ${exec_prefix} for me (when compiling from source). This is a well-known misfeature of autoconf: https://stackoverflow.com/questions/54405359/how-to-recursively-substitute-variable-for-a-path-in-bash-variable-in-configure

I wonder if either make install or RPM are fixing it?

@rwmjones
Copy link
Collaborator

So it's make install. I'll add my patch since it should be ok after all.

rwmjones added a commit that referenced this issue Mar 24, 2021
@rwmjones
Copy link
Collaborator

I pushed this: 5014da5

The Makefile.am probably needs adjusting further to install this file in some place, although maybe we don't want to install this for everyone, just "suggest" it.

@rathann
Copy link
Author

rathann commented Mar 24, 2021

So it's make install. I'll add my patch since it should be ok after all.

Interesting. I haven't actually checked the contents between %build and %install, so I haven't seen this.

I pushed this: 5014da5

Thanks!

The Makefile.am probably needs adjusting further to install this file in some place, although maybe we don't want to install this for everyone, just "suggest" it.

I think it's fine to leave it in the source tree and let distros consume it at will for now.

@jkhsjdhjs
Copy link

It might be even better to change WantedBy= from multi-user.target to local-fs-pre.target. This way the filesystems can be used in /etc/fstab even without specifying x-systemd.requires=ldm.service. If changed make sure to also add Before=local-fs-pre.target, so local-fs-pre.target isn't considered active until ldm.service is.

They're currently doing it this way on Arch Linux: https://github.com/archlinux/svntogit-community/blob/a7db3683d17aca7891a69110d9e6e2af9cea0544/trunk/ldmtool.service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants