tiangolo/babun-docker

Cannot run setup on windows 10

numediaweb opened this issue · 8 comments

Could not run neither of automatic nor manual setup on babun and have those errors instead;

Automatic

{ ~ }  » curl -s https://raw.githubusercontent.com/tiangolo/babun-docker/master/setup.sh | source /dev/stdin
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: bin/babun-docker.sh: line 7: syntax error near unexpected token `$'{\r''
'ash: bin/babun-docker.sh: line 7: `function docker {

Manual

{ .babun-docker } master » source ./setup.sh
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: $'\r': command not found
bash: ./setup.sh: line 78: syntax error near unexpected token `$'{\r''
'ash: ./setup.sh: line 78: `function babun-docker-update {

First, it seems you are using bash as your shell. You may want to try zsh as it comes with many useful features, including better history completion. To use it you can run babun shell /bin/zsh and then restart Babun.

It seems like the setup.sh file you are using has "Carriage Return" characters ("CR"), bash and Linux only use "Line Feed" characters, not the sequence "Carriage Return Line Feed" that is used in Windows files. Bash doesn't understand those characters and throws that error "\r token".

What is strange is that since a long time the files where converted from line endigs with CRLF to LF, and recently I modified (quite an amount of) code to support bash and not only zsh. Could it be possible that you are receiving a cached / proxied version of the file?

Thanks @tiangolo for the hints.

I used the setup.sh on this repository

curl -s https://raw.githubusercontent.com/tiangolo/babun-docker/master/setup.sh | source /dev/stdin

maybe updating it can solve the problem?

Hmm, strange.

Do the following:
babun-docker-update
cd ~/.babun-docker
git status

What do you get?

darek commented

git config --global core.autocrlf false

clone again repository and You should be good

Thanks for the tip @darek . Did it work for you @numediaweb ? Should we close this issue?

I had the very same issue while trying to execute the setup.sh from babun(bash shell) on windows 7.
Here is how I resolved it:

  1. Cloned the babun-docker repo
  2. Doubled checked the EOL conversion of these files (setup.sh, default-config.sh and bin/babun-docker.sh), like I suspected the line ending of those files were in Dos/windows format.
  3. Changed the EOL to Unix format and it worked on next attempt.

Now I have got docker working on babun. :)

It seems like the problem is solved for these cases. If someone else is having an issue, please report here, maybe part of the setup could include running dos2unix to make sure that the line endings is not changed while installing / cloning.

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.