Open Tony763 opened 1 year ago
Hmm, I see that the current code isn't quite working correctly. However the change doesn't seem to work if calling the script from outside the mycroft-core folder (which I believe was the intent of the original code).
If I call mycroft-start debug
from my home folder, it works normally.
Or You think calling start-mycroft.sh
? Should it be called directly?
At least it worked previously.
A simple addition seems to be to add
cd $(readlink -f "$0" | xargs dirname)
before the setting DIR (the old version did something similar)
which will execute the script from the mycroft folder.
The mycroft-start duplicates this but in a bash-specific way.
@PureTryOut do you have any suggestions or comments?
If I change cd -P "$( dirname "$SOURCE" )"
into cd $(readlink -f "$0" | xargs dirname)
in start-mycroft.sh
then it can be called from every place. But If I call mycroft-start
then it will point to the wrong directory (/srv/mycroft-core/bin
). $0
will return path to first called script.
@PureTryOut do you have any suggestions or comments?
Well my suggestion would be merging https://github.com/MycroftAI/mycroft-core/pull/2802 which changes large parts of the script anyway. :stuck_out_tongue_winking_eye:
The original code wasn't mean to make it possible to run the script from everywhere persé. As far as I can see it will always cd to where the script is located (the real location, not any symlink). I suppose the bin/mycroft-start
use-case hasn't been tested very well, but with https://github.com/MycroftAI/mycroft-core/pull/2802 I was getting rid of the duplicated entry point anyway.
I'm not entirely sure what to do here besides just getting my PR in, having 2 differently located and named entry points is a bit of a strange situation anyway.
Description
Hi, I'm proposing a fix for issue #3137.
For getting directory use
$PWD
and for getting directory of script which was caller use$0
.How to test
Try to start Mycroft by calling
mycroft-start debug
andsh start-mycroft.sh debug
Contributor license agreement signed?
CLA [x] (Whether you have signed a CLA - Contributor Licensing Agreement