MycroftAI / enclosure-picroft

Mycroft interface for Raspberry Pi environment
https://mycroft.ai/documentation/picroft
GNU Lesser General Public License v3.0
803 stars 191 forks source link

mycroft-setup-wizard command doesn't exist on SSH #124

Closed forslund closed 3 years ago

forslund commented 4 years ago

Seems like the mycroft-setup-wizard can't be run from SSH.

The alias is created only for local sessions. Perhaps it should be created for both or at least setup to show a message "Please only use this command from a local session" or something

fermulator commented 4 years ago

Interesting, verified this is true.

.bashrc has:

######################################################################
# Initialize Mycroft
######################################################################
source auto_run.sh

It is created via an alias definition within that file;

alias mycroft-setup-wizard="cd ~ && touch first_run && rm -f .setup_choices && rm -f .setup_stage && source auto_run.sh"

... hmm ... if I run auto_run.sh manually, it loads up fine. (so there's nothing in there that is actually bailing if non-local/attached terminal TTY)

this is what is there

(.venv) pi@picroft:~ $ grep SSH_CLIENT auto_run.sh sh 
if [ "$SSH_CLIENT" = "" ] && [ "$(/usr/bin/tty)" != "/dev/tty1" ]; then
if [ "$SSH_CLIENT" = "" ] && [ "$(/usr/bin/tty)" = "/dev/tty1" ];

the default shell IS /bin/bash for pi user .. k;

(.venv) pi@picroft:~ $ grep pi /etc/passwd
pi:x:1000:1000:,,,:/home/pi:/bin/bash

AND if I run /bin/bash it auto-sources the auto_run stuff ..

for me, when I login to pi@mycroft-device-blah, it auto-loads /bin/bash, and does the auto_run.sh script; IF you CTRL+C out of that "too fast", then the aliases won't be defined; but if you let it run to the mycroft-cli first, THEN CTRL+C, the aliases has been defined;

--

none-the-less; would the fix here be simply to have a .bash_aliases file for the pi user? move the alias def for mycroft-setup-wizard there?

(.venv) pi@picroft:~ $ cat .bash_aliases 
alias mycroft-setup-wizard="cd ~ && touch first_run && rm -f .setup_choices && rm -f .setup_stage && source auto_run.sh"

works well for me;