aenix-io / talos-bootstrap

An interactive Talos Linux installer
Apache License 2.0
105 stars 12 forks source link

Issues running on MacOS #11

Open insuusvenerati opened 6 months ago

insuusvenerati commented 6 months ago

Getting the error when running talos-bootstrap install. On MacOS 13.6.6 talosctl version v1.6.7

❯ talos-bootstrap install
/usr/local/bin/talos-bootstrap: line 126: syntax error near unexpected token `;;'
/usr/local/bin/talos-bootstrap: line 126: `        case " ${seen} " in *" ${mac} "*) continue ;; esac # remove duplicated nodes'
kvaps commented 6 months ago

Hi @insuusvenerati could you please provide output of:

/bin/sh --version
insuusvenerati commented 6 months ago
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin22)
Copyright (C) 2007 Free Software Foundation, Inc.
kvaps commented 6 months ago

It seems case statement does not work inside subshell $() for some reason.

Please try this version from #12 https://github.com/aenix-io/talos-bootstrap/raw/8f3f1985a8b84b535d7ed01014d0f25bab13400b/talos-bootstrap

insuusvenerati commented 6 months ago

Hey! That's works! Thanks so much

insuusvenerati commented 6 months ago

Is there any chance you can get this to work on macOS? Mac doesn't have an iproute2 package so instead I used iproute2mac but get this error

❯ ./talos-bootstrap install
Option "-o" is unknown, try "ip help".
awk: extra ] at source line 1
 context is
        NR>1 >>>  {sub(/^[^/] <<< 
awk: nonterminated character class ^[^
 source line number 1
awk: illegal primary in regular expression *"$ at "$
 source line number 1
 context is
         >>> /*"$/ <<<
kvaps commented 6 months ago

Try installing awk

https://formulae.brew.sh/formula/awk

thecodeassassin commented 6 months ago

Try installing awk

https://formulae.brew.sh/formula/awk

Same happens with the latest version of awk installed

awk: extra ] at source line 1
 context is
    NR>1 >>>  {sub(/^[^/] <<<
awk: nonterminated character class ^[^
 source line number 1
awk: illegal primary in regular expression *"$ at "$
 source line number 1
 context is
     >>> /*"$/ <<<
TrooperT commented 2 months ago

Sorry to necro this but as a resolution, it appears that some of the awk syntax used by talos-bootstrap includes GNU extensions that require using gawk try brew install gawk and do one of 2 things:

  1. symlink awk against gawk or
  2. replace all instances of awk with gawk in talos-boostrap using sed -i.bak 's/awk/gawk/' talos-bootstrap

I came to this conclusion after a bit of blue/green testing between my daily driver MBP and a clean Ubuntu VM install. in the clean install /usr/bin/awk links to /etc/alternatives/awk and /etc/alternatives/awk links back to /usr/bin/gawk thus explaining the difference in behaviour