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
Remove symlinks for fedora-* services #127
Remove symlinks for fedora-* services #127
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Those patches should be merged to one commit. It is one change "going from static enable to presets" and separate commits could be confusing for others or during backports.
Good point. Commits squashed into one. :)
We're still waiting for this BZ to be resolved first: |
UPDATE: Pull-requst by @keszybz was merged into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to add systemd_post and frinds scriplets to spec file:
https://fedoraproject.org/wiki/Packaging:Scriptlets#Scriptlets
Thanks for spotting this, I wasnt't aware of this. I will update the commit. :) |
I have updated the specfile, but I'm unsure about few things:
I was looking at I have also set the I'm updating the commit for RHEL7 in the same way. |
Please, check if the requested changes are OK. Thank you.
initscripts.spec
Outdated
Requires(preun): /sbin/chkconfig | ||
BuildRequires: glib2-devel popt-devel gettext pkgconfig systemd | ||
Requires(preun): systemd-units | ||
BuildRequires: glib2-devel popt-devel gettext pkgconfig systemd-devel |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see the guidelines, they are up to date: https://fedoraproject.org/wiki/Packaging:Scriptlets#Systemd. systemd-units
has been gone for many many years. You need systemd-devel only when linking to the systemd libraries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And yes, using %systemd_postun
(without restart) is correct.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I will fix that. Just one more question - should I also add this line?
%{?systemd_requires}
I'm not sure about the purpose of that line...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It generated the required Requires(pre) and Requires(post) lines.
initscripts.spec
Outdated
@@ -57,19 +60,28 @@ touch %{buildroot}%{_sysconfdir}/rc.d/rc.local | |||
chmod 755 %{buildroot}%{_sysconfdir}/rc.d/rc.local | |||
|
|||
%post | |||
%systemd_post fedora-import-state.service | |||
%systemd_post fedora-readonly.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better to put both services on the same line, to save systemctl invocations.
initscripts.spec
Outdated
/usr/sbin/chkconfig --add network > /dev/null 2>&1 || : | ||
/usr/sbin/chkconfig --add netconsole > /dev/null 2>&1 || : | ||
if [ $1 -eq 1 ]; then | ||
/usr/bin/systemctl daemon-reload > /dev/null 2>&1 || : | ||
fi | ||
|
||
%preun | ||
%systemd_preun fedora-import-state.service | ||
%systemd_preun fedora-readonly.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too.
initscripts.spec
Outdated
if [ $1 = 0 ]; then | ||
/usr/sbin/chkconfig --del network > /dev/null 2>&1 || : | ||
/usr/sbin/chkconfig --del netconsole > /dev/null 2>&1 || : | ||
fi | ||
|
||
%postun | ||
%systemd_postun fedora-import-state.service | ||
%systemd_postun fedora-readonly.service |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here too.
@@ -12,3 +12,6 @@ ExecStart=/lib/systemd/fedora-import-state | |||
Type=oneshot | |||
TimeoutSec=0 | |||
RemainAfterExit=yes | |||
|
|||
[Install] | |||
WantedBy=local-fs.target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be WantedBy=basic.target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one will have to answer @lnykryn, I'm no expert on systemd. I have just used the targets as they were before (created by symlinks that we're removing).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would put sysinit.target there, basic target seems a bit late to me.
@deekej just for FYI this is nicely documented in bootup manpage.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After looking at the systemd bootup process details (and in context how it was done before and what it does), I agree with @lnykryn. The basic.taget
can be already expecting that fedora-import-state.service
has finished.
If you do not want the local-fs.target
for that, then sysinit.target
seems to be a way to go. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, sysinit.target
is better.
@@ -11,3 +11,6 @@ ExecStart=/lib/systemd/fedora-loadmodules | |||
Type=oneshot | |||
TimeoutSec=0 | |||
RemainAfterExit=yes | |||
|
|||
[Install] | |||
WantedBy=basic.target |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, most likely WantedBy=sysinit.target
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. @lnykryn?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep we can do that.
Updated commit pushed. Please re-check, thanks!
initscripts.spec
Outdated
%systemd_post fedora-import-state.service \ | ||
fedora-loadmodules.service \ | ||
fedora-readonly.service | ||
|
||
/usr/sbin/chkconfig --add network > /dev/null 2>&1 || : | ||
/usr/sbin/chkconfig --add netconsole > /dev/null 2>&1 || : | ||
if [ $1 -eq 1 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we can also drop the daemon-reload calls from the spec file.
https://fedoraproject.org/wiki/Changes/systemd_file_triggers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, please keep them as written in the guidelines. They evaluate to nothing if not necessary, but having the macro leaves the window open to change the implementation in systemd later on if necessary.
@@ -12,3 +12,6 @@ ExecStart=/lib/systemd/fedora-import-state | |||
Type=oneshot | |||
TimeoutSec=0 | |||
RemainAfterExit=yes | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, but then you need Before=sysinit.target, not Before=basic.target.
@@ -10,3 +10,6 @@ ExecStart=/lib/systemd/fedora-readonly | |||
Type=oneshot |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/usr/lib/...
initscripts.spec
Outdated
fedora-readonly.service | ||
|
||
# This should be removed in Rawhide for Fedora 29: | ||
%triggerin -- initscripts > 9.77 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this can work. This will get triggered every time this package is installed or upgraded.
Maybe something like this:
%triggerpostun -- initscripts <= 9.77
echo "Manually enabling fedora-import-state.service and fedora-readonly.service on upgrade"
systemctl enable fedora-import-state.service fedora-readonly.service
(untested)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we were discussing this with @lnykryn, because we were unsure about it. This will be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated this part. I need to make just one more test, but it seems promising.
Another round of improvements, please re-check.
The symlinks are no longer needed. Enablement of default services is now managed by 'fedora-release' package.
LGTM. |
Unfortunately, we're still waiting on Dennis to make a new release of |
These symlinks are no longer needed, because services enabled by default are now managed by
fedora-release
package.Before merging this PR/releasing new version of initscripts, we should wait for necessary changes to be made in
fedora-release
.