Skip to content
This repository was archived by the owner on Sep 8, 2024. It is now read-only.

Conversation

PureTryOut
Copy link
Contributor

@PureTryOut PureTryOut commented Sep 6, 2020

Description

This allows start-mycroft.sh and stop-mycroft.sh to start and stop MyCroft when it's installed system-wide, assuming the files are installed as start-mycroft and stop-mycroft (so without the .sh extension). This is especially useful for distribution packaging which won't have a git checkout with the source and a virtualenv available and can probably be used for Pip as well.

Note that this PR depends on #2686 and shouldn't be merged without it. I'll rebase this PR on the latest dev when #2686 is merged.

How to test

Install MyCroft system wide (e.g. python3 setup.py install --prefix=/usr --root=/, make sure you have all the deps installed system-wide!), copy/rename start-mycroft.sh to start-mycroft and optionally put it in /usr/bin. Then just run start-mycroft all. Do the same for stop-mycroft.sh.

Contributor license agreement signed?

CLA [x] (Whether you have signed a CLA - Contributor Licensing Agreement

Fixes #2191

@devops-mycroft devops-mycroft added the CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) label Sep 6, 2020
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

ShellCheck is a static analysis tool for shell scripts with the goal to:
- point out and clarify typical beginner's syntax issues that cause a
shell to give cryptic error messages
- point out and clarify typical intermediate level semantic problems
that cause a shell to behave strangely and counter-intuitively
- point out subtle caveats, corner cases and pitfalls that may cause an
advanced user's otherwise working script to fail under future
circumstances

I've ran this tool over both start-mycroft.sh and stop-mycroft.sh and
fixed any issue that popped up
This makes the start and stop scripts compatible with POSIX shells.

Overview of the changes:
- "function" statements removed, not necessary and incompatible
- dashes in function and variable names for lower ones (- to _)
- source statements changed for .
- double square brackets replaced for single ones
- double equal statements replaced for single ones
- &> (piping stdout and stderr to the same file) replaced for 2>&1 >
- sourcing of mycroft-skill-testrunner replaced with direct execution
with Bash
- replaced BASH_SOURCE with $0, these scripts are never sourced anyway
- replaced "echo -n" statements with "printf"
- merged the "" and "all" cases to a single one
In case of Linux distributions, MyCroft will be installed system-wide
and a git checkout is not available. Without this change,
start-mycroft.sh and stop-mycroft.sh however expect that git checkout to
be available and it won't launch the services without it.

Modify the script to check if it's being ran systemwide, and if so skip
the usual checks and steps that come to play when running in a git
checkout. This way these scripts can be used to start and stop MyCroft
services from distribution installed packages, assuming these scripts
are installed as `start-mycroft` and `stop-mycroft`.
@devops-mycroft
Copy link

Voight Kampff Integration Test Failed (Results)

@krisgesling krisgesling added Type: Enhancement - proposed New proposal for a feature that is not currently a priority on the roadmap. tagged for review and potential merge labels Sep 15, 2020
@devops-mycroft
Copy link

Voight Kampff Integration Test Succeeded (Results)

@krisgesling krisgesling added Status: To be reviewed Concept accepted and PR has sufficient information for full review and removed tagged for review and potential merge labels Sep 24, 2020
@krisgesling krisgesling linked an issue Sep 24, 2020 that may be closed by this pull request
Copy link
Contributor

@fermulator fermulator left a comment

Choose a reason for hiding this comment

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

@@ -1,4 +1,4 @@
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

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

BLOCKED by https://github.com/MycroftAI/mycroft-core/pull/2686/files

(pending that, then a rebase or merge to update - then we can review this diff a little more cleanly)

@PureTryOut
Copy link
Contributor Author

I have different plans to do system-wide (and per-user) setups actually. Closing this in favour of a new PR soon to come.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA: Yes Contributor License Agreement exists (see https://github.com/MycroftAI/contributors) Status: To be reviewed Concept accepted and PR has sufficient information for full review Type: Enhancement - proposed New proposal for a feature that is not currently a priority on the roadmap.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make start-mycroft.sh independent from dev_setup.sh Mycroft installs skills in /opt and logs in /var
7 participants