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

Remove symlinks for fedora-* services #127

Merged
merged 1 commit into from Oct 19, 2017
Merged

Remove symlinks for fedora-* services #127

merged 1 commit into from Oct 19, 2017

Conversation

deekej
Copy link
Contributor

@deekej deekej commented Sep 19, 2017

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.

Copy link
Member

@lnykryn lnykryn left a 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.

@deekej deekej dismissed lnykryn’s stale review September 20, 2017 09:39

Good point. Commits squashed into one. :)

@deekej deekej self-assigned this Sep 20, 2017
@deekej deekej added this to the initscripts-10.0 milestone Sep 20, 2017
@deekej
Copy link
Contributor Author

deekej commented Oct 16, 2017

We're still waiting for this BZ to be resolved first:
https://bugzilla.redhat.com/show_bug.cgi?id=1493479

@deekej
Copy link
Contributor Author

deekej commented Oct 16, 2017

UPDATE: Pull-requst by @keszybz was merged into fedora-release package.

Copy link
Member

@lnykryn lnykryn left a 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

@deekej
Copy link
Contributor Author

deekej commented Oct 16, 2017

Thanks for spotting this, I wasnt't aware of this. I will update the commit. :)

@deekej
Copy link
Contributor Author

deekej commented Oct 16, 2017

I have updated the specfile, but I'm unsure about few things:

  • I have added the Requires of systemd-units for post, postun and preun phases.
  • I have added the BuildRequires for systemd-devel instead of systemd (as suggested in the wiki)

I was looking at httpd package on how it does in Rawhide, and it is different compared to the wiki. But IMHO that shouldn't be a problem for the build/upgrade/removal of initscripts.


I have also set the fedora-import-state.service and fedora-readonly.service to not be restarted during upgrade. These are oneshot type of services, and it doesn't make sense to me to run them during upgrade, it could break things. If I'm wrong, please correct me.


I'm updating the commit for RHEL7 in the same way.

@deekej deekej dismissed lnykryn’s stale review October 16, 2017 18:12

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
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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...

Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

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).

Copy link
Member

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.

Copy link
Contributor Author

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. :)

Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. @lnykryn?

Copy link
Member

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.

@deekej deekej dismissed keszybz’s stale review October 16, 2017 19:49

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
Copy link
Member

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

Copy link
Contributor

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

Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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)

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

@deekej deekej dismissed keszybz’s stale review October 18, 2017 13:33

Another round of improvements, please re-check.

  The symlinks are no longer needed. Enablement of default services is
  now managed by 'fedora-release' package.
@keszybz
Copy link
Contributor

keszybz commented Oct 18, 2017

LGTM.

@deekej deekej merged commit 5829c81 into fedora-sysv:master Oct 19, 2017
@deekej deekej deleted the remove-systemd-target-symlinks branch October 19, 2017 09:22
@deekej
Copy link
Contributor Author

deekej commented Oct 19, 2017

Unfortunately, we're still waiting on Dennis to make a new release of fedora-release package... :-/

@deekej deekej removed the dont-merge label Nov 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants