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

feat(install): use systemV mechanism to install the demo as fallback. #327

Conversation

merlin-northern
Copy link
Contributor

@merlin-northern merlin-northern commented Nov 12, 2024

feat(install): use systemV mechanism to install the demo as fallback.

If systemd is not present or not running we fall back to a /etc/init.d
mechanism.

Changelog: Make /etc/init.d a fallback for the systems where systemd is not present or not running
Ticket: MEN-7694
Signed-off-by: Peter Grzybowski peter@northern.tech

@merlin-northern merlin-northern force-pushed the men_7694_feasability_of_running_mender_demo_artifact_in_virtual_device_for_app_updates_ branch 8 times, most recently from 5be4c10 to 06180da Compare November 12, 2024 10:22
Copy link
Contributor

@lluiscampos lluiscampos left a comment

Choose a reason for hiding this comment

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

FYI, I have checked what the Debian packages do and I was wrong. The auto-generated code is set so that either installs/enable/starts the systemd service or does nothing at all.

Copy link
Contributor

@lluiscampos lluiscampos left a comment

Choose a reason for hiding this comment

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

@merlin-northern What are the next steps? Are we going to demo, review it, ... or?

@merlin-northern
Copy link
Contributor Author

@merlin-northern What are the next steps? Are we going to demo, review it, ... or?

I choose " ... or?".

The next step I would pick the 3SP task next or this sprint and make this production grade as per the comments in the ticket. there are two things to consider (apart from the rc.local way which is a bit hacky): the bash disown and the case where there is no sysV, which means there is nothing :)
there is also a mad-too-much-for-just-a-demo-way:

  • if systemd is not present fall back to sysV
  • if the sysV is not present, create init.d, run the start but print warning

We already agreed on small post su demo 😘

Feel free to review, this is ready with the mentioned comments. notice the hard-coded runlevel 3 -- I went for the easiest way.

@lluiscampos
Copy link
Contributor

Thank you for the post-SU demo - it was great. I think now that this is the way to go 🚀

@merlin-northern
Copy link
Contributor Author

Thank you for the post-SU demo - it was great. I think now that this is the way to go 🚀

it was a pleasure amigo.

@merlin-northern merlin-northern force-pushed the men_7694_feasability_of_running_mender_demo_artifact_in_virtual_device_for_app_updates_ branch from 77afad6 to 62e969a Compare January 26, 2025 19:09
@merlin-northern merlin-northern changed the title feat(install): use systemV mechanism to install the demo. feat(install): use systemV mechanism to install the demo as fallback. Jan 26, 2025
Copy link
Contributor

@danielskinstad danielskinstad left a comment

Choose a reason for hiding this comment

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

Perhaps change the ticket in the commit to the one in the sprint (MEN-7734)?
Feel free to ignore my comments, looks good to me 🚀

chmod 755 /etc/init.d/mender-demo-artifact

# r=`runlevel`
# ${r#"${r%?}"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to keep these comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

woops. sorry leftovers. thanks for catching that.

fi
fi

if test "$HAVE_SYSTEMD" = "yes"; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if test "$HAVE_SYSTEMD" = "yes"; then
if test -d /lib/systemd/system && which systemctl 2>/dev/null >&2 && pidof systemd; then

Perhaps it would simply it if you removed the HAVE_SYSTEMD variable and did something like this? You only really check the variable here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure. I removed the HAVE_SYSTEMD variable, and retested under mendersoftware/mender-client-docker-addons and rpi4.

If systemd is not present or not running we fall back to a /etc/init.d
mechanism.

Changelog: Make /etc/init.d a fallback for the systems where systemd is not present or not running
Ticket: MEN-7694
Signed-off-by: Peter Grzybowski <peter@northern.tech>
@merlin-northern merlin-northern force-pushed the men_7694_feasability_of_running_mender_demo_artifact_in_virtual_device_for_app_updates_ branch from 62e969a to a6a8200 Compare January 27, 2025 17:00
@mender-test-bot
Copy link

mender-test-bot commented Jan 27, 2025

Merging these commits will result in the following changelog entries:

Changelogs

mender-demo-artifact (men_7694_feasability_of_running_mender_demo_artifact_in_virtual_device_for_app_updates_)

New changes in mender-demo-artifact since master:

Features
  • Make /etc/init.d a fallback for the systems where systemd is not present or not running
    (MEN-7694)

@merlin-northern merlin-northern merged commit 61ccce6 into mendersoftware:master Jan 27, 2025
1 check passed
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

Successfully merging this pull request may close these issues.

4 participants