Fork me on GitHub

Does anyone have a shell oneliner for installing both babashka and bbin that works on Linux? Something like bbup? Context: I want to lower the effort required to share bb scripts with colleagues who don’t use Clojure each day. I would love to have a README with something like

# My tool

## setup

    curl  | ...
    bbin install io.github.teodorlu/mytool


For linux and macOS you can use:

bash <(curl )


I notice the versions should be updated in the bbin install instructions (cc @U0CLCL6T0)

Bob B14:02:07

while not as specific as something like bbup, if brew is in use that's an option


good point, with brew you even have to only install bbin since that depends on babashka


I threw something together: It doesn't add the bbin folder to PATH yet. I want to do that defensively -- only modifiy bashrc and zshrc files if it's not on PATH together.


Let me know if I'm stepping on any toes here, Borkdude πŸ™‚


not at all :) πŸ‘


if you click on the "view all" thing, some Rust stuff still appears

βœ… 1
πŸ‘ 1

Thanks, I'll check it out πŸ‘


When copying the url via the UI you get a Rust url


I almost accidentally installed rust

πŸ˜… 1

When copying the url manually:

curl --proto '=https' --tlsv1.2 -sSf  | sh
/usr/bin/sh: 18: Syntax error: "(" unexpected


I suggest trying it from a vanilla ubuntu docker image ;)

πŸ’― 1

I guess it should be piped into | bash instead of sh. Also the extension suggests .sh while the script actually uses bash syntax

πŸ‘ 1

bbin doesn't work after install and I didn't get a message about PATH

πŸ‘ 1

I end up with the amd binary on arm linux, not sure why


user=> (System/getProperty "os.arch")


[email protected]:/# uname -a
Linux 03ec0c99f8cb 5.10.76-linuxkit #1 SMP PREEMPT Mon Nov 8 11:22:26 UTC 2021 armv7l armv7l armv7l GNU/Linux


This appears to be in the install script


ah, uname -m returns armv7l


As you've noticed, it doesn't quite work yet. 1. I obviously should add a message that this doesn't quite work yet to the HTML 2. I'd like to make it work under "posix sh" - so we don't need to rely on bash being installed on newer macs. I'm not 100 % sure about the subtle differences between posix sh and bash, but I think it should be doable. 3. Right now I'm not using the javascript "which platform am I using" for anything - I always download and run ( 4. Not sure why you're getting an amd binary on arm linux, I'd like to avoid that. 5. Testing from Docker is a great suggestion - I've been "testing" so far with bash --dry-run, but Docker is great for testing what actually happens. 6. "When copying the url via the UI you get a Rust url, I almost accidentally installed rust". Yeah, sorry about that! It surprised me as well. The javascript code ignored the HTML content, and had hard-coded the script from a javascript constant instead. ( Thanks for testing!! πŸ™Œ


@U04V15CAJ I've fixed the errors I found, and the scripts seem to be working when I'm testing with Docker. To test (again):

curl --proto '=https' --tlsv1.2 -sSf  | sh
I also made a minmal dockerfile:
$ git clone [email protected]:teodorlu/
$ cd 
$ docker build -f ex4.dockerfile -t tmp . && docker run --rm -it tmp
# curl --proto '=https' --tlsv1.2 -sSf  | sh
Downloading  to /tmp/tmp.sradVD3GDy
Successfully installed bb in /usr/local/bin
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 26760  100 26760    0     0  86845      0 --:--:-- --:--:-- --:--:-- 86601
bbup has detected that you are running bash

    export PATH="$HOME/.babashka/bbin/bin:$PATH"

to /root/.bashrc ...Done!
Please run

    source /root/.bashrc

or restart your shell to run Babashka or bbin.
after installing:
[[email protected] /]# bb -e '(inc 10)'
[[email protected] /]# source /root/.bashrc
[[email protected] /]# bbin install io.github.borkdude/carve
[[email protected] /]# carve --help
Downloading pod clj-kondo/clj-kondo (2023.01.20)
Successfully installed pod clj-kondo/clj-kondo (2023.01.20)
Carve: remove unused Clojure vars.

  --report            Set to true to report and not transform code
  --interactive       Interactive mode: ask what to do with an unused var
  --silent            When truthy, does not write to stdout. Implies :interactive false.
  --report-format     The report format: :text, :edn or :ignore
  --ignore-vars       A list of vars to ignore
  --paths             A list of paths to analyze (files and dirs)
  --out-dir           Emit transformed code to out-dir instead of overwriting
  --aggressive        Run carve multiple times to detect transitive unused vars
  --clj-kondo/config  A map of clj-kondo config opts that are passed on to clj-kondo
  --opts              The options as an EDN literal
  --api-namespaces    A list of namespaces to ignore
  --dry-run           Dry run
  --help              Display help
  --carve-ignore-file The file with ignored vars

πŸŒ™ 2

I'm looking into making a library compatible and this library has a data_readers.clj file. So far I haven't made babashka pick up on this automatically as this incurs a little bit of startup time (to scan the classpath for those files). I'm considering doing this lazily, when an (unknown) data reader is used for the first time...

Daniel Jomphe15:02:33

Data readers are quite tool-breaking, for sure (or tools aren't yet invested in being data readers compatible!). Not sure about all possible tradeoffs, but laziness might be great.


Yeah, I'm not a big fan of those, but they do exist


Can't think of a reason why laziness might cause problems

βž• 1

... and merged