Terrastories / offline-field-kit

Quick Start to host Terrastories on an offline field kit
2 stars 0 forks source link

etchost value not generated correctly #3

Closed MariaMayang closed 9 months ago

MariaMayang commented 9 months ago

the install.sh script isnt correctly adding host value, as "\n" arent being parsed as paragraphs

lauramosher commented 9 months ago

@MariaMayang Can you please provide the output of what was added to your file?

luandro commented 9 months ago

@lauramosher The /etc/hosts file had a single line of commented text, with 127.0.0.0 terrastories.local and comments all smushed together, and \n separating them, but not parsed as a paragraph.

rudokemper commented 9 months ago

Operating system: Manjaro Linux (Arch)

MariaMayang commented 9 months ago

142 cd offline-field-kit-main/ 143 ls 144 chmod +x install.sh 145 chmod +x install.sh 146 ls 147 bash install.sh 148 docker rm -f $(docker ps -aq) 149 bash install.sh 150 cat /etc/hosts~ 151 cat /etc/hosts 152 sudo vim /etc/hosts 153 sudo pacman -S vim 154 sudo vim /etc/hosts 155 cp docker/local/.env.example docker/local/.env

rudokemper commented 9 months ago

I was not able to reproduce in Ubuntu 22.04.

luandro commented 9 months ago

@rudokemper the /etc/hosts file looks good on Ubuntu?

rudokemper commented 9 months ago

Yes

# End of section
# Added by Terrastories
127.0.0.1 terrastories.local
# End of section
luandro commented 9 months ago

Interesting, why would Arch parse it differently...

lauramosher commented 9 months ago

What version of sh and bash does Manjaro use?

lauramosher commented 9 months ago

@luandro Does this work for you?

sudo -- bash -c "echo -e '# Added by Terrastories\n127.0.0.1 terrastories.local\n# End of section' >> /etc/hosts"
luandro commented 9 months ago

What version of sh and bash does Manjaro use?

GNU bash, versão 5.2.21(1)-release (x86_64-pc-linux-gnu) & zsh 5.9 (x86_64-pc-linux-gnu)

If you run this on its own, does it work?

echo '# Added by Terrastories\n127.0.0.1 terrastories.local\n# End of section' >> /etc/hosts

This doesnt get parsed correctly.

@luandro Does this work for you?

sudo -- bash -c "echo -e '# Added by Terrastories\n127.0.0.1 terrastories.local\n# End of section' >> /etc/hosts"

This does!

lauramosher commented 9 months ago

@luandro Great. I've updated the script to use the new command.

Semi-related, the script does not need to made an executable with chmod +x since we are invoking the file with bash. Just noticed that in the lines @MariaMayang posted.