meonkeys / shb

Source code for an awesome book about self-hosting.
https://selfhostbook.com
GNU Affero General Public License v3.0
39 stars 2 forks source link

`sed` illegal option error when running `./provision.sh` #1

Closed a-w-1806 closed 3 weeks ago

a-w-1806 commented 3 weeks ago

Hi!

First of all, thank you for all the great work!

I am trying to follow the steps and I am encountering this:

❯ ./provision.sh
sed: illegal option -- -
usage: sed script [-Ealnru] [-i extension] [file ...]
        sed [-Ealnu] [-i extension] [-e script] ... [-f script_file] ... [file ...]

Might be some bug in the script?

meonkeys commented 3 weeks ago

Ah dang, yep. provision.sh assumes GNU sed. Sorry, I just broke that when I added something to make sure the right version of Ansible is installed (in 35d204d3e0b8486a9ff7edf14e08eda7ad768d90)! I'll just revert it for now, hopefully that'll get provision.sh working for you again. Perhaps that sed command can be made more compatible with more versions of sed.

a-w-1806 commented 3 weeks ago

Yep I am using macOS so that might be the reason?

meonkeys commented 3 weeks ago

Do you know how to tweak that sed line to make it compatible with yours? Maybe it's BSD sed if it's on macOS.

a-w-1806 commented 3 weeks ago

Unfortunately no I am by no means a power sed user 😞

meonkeys commented 3 weeks ago

No worries, I think I got it. Please try updating your clone, see if it works now.

meonkeys commented 3 weeks ago

Fixed in 35d204d3e0b8486a9ff7edf14e08eda7ad768d90, hopefully.

a-w-1806 commented 3 weeks ago

Thanks for the quick response! I am now seeing this:

❯ ./provision.sh
ERROR: Ansible core 2.16.1 or later required. Unable to determine version.

However:

❯ ansible --version
ansible [core 2.17.0]
...
meonkeys commented 3 weeks ago

Uff, yeah, that was super naive of me to think sort -V would be portable (I bet that's what's breaking).

I know how to fix that bug in the version check for macOS, but it looks like you'll still need a more recent Ansible core (note the mention of version 2.16.1 in provision.sh). Will you figure out how to upgrade Ansible core, and I'll fix the version check for macOS in provision.sh?

a-w-1806 commented 3 weeks ago

🤔 I think I am having the latest ansible from Homebrew already. 2.17.0 is already later than 2.16.1 right?

meonkeys commented 3 weeks ago

Whoops, indeed, my bad. Does provision.sh get farther along for you now?

a-w-1806 commented 3 weeks ago

And yes I think this is expected as I haven't modified my config file yet:

❯ ./provision.sh
ssh: Could not resolve hostname mario_server: nodename nor servname provided, or not known
Error: unable to SSH to the server in batch mode.

Please fix your SSH client config and try again.

Thanks for the fix!

meonkeys commented 2 weeks ago

Sure thing. I appreciate your bug report.