Skip to content

Instantly share code, notes, and snippets.

@donthorp
Last active December 1, 2021 19:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save donthorp/3358aac2a9cc272dd8332a055e17cc8b to your computer and use it in GitHub Desktop.
Save donthorp/3358aac2a9cc272dd8332a055e17cc8b to your computer and use it in GitHub Desktop.
Script for updating Babashka on Pop OS (Ubuntu) using Babashka
#! /usr/bin/env bb
;; Simple script for updating babashka to latest
;;
;; Author: Don Thorp
;; Created: 1 Dec 2021
;;
;; Source: https://github.com/babashka/babashka#installation
;;
;; $ curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install
;; $ chmod +x install
;; $ ./install
(ns script
(:require
[babashka.curl :as curl]
[babashka.fs :as fs]
[clojure.java.shell :as shell :refer [sh]]
[clojure.string :as str]))
(defn get-install [] (curl/get "https://raw.githubusercontent.com/babashka/babashka/master/install"))
(defn bash [& args]
(sh "/usr/bin/env" "bash" "-c" (str "'" (str/join " " args) "'")))
(let [install (fs/delete-on-exit (File/createTempFile "install" ""))]
(spit install (:body (get-install)))
(.setExecutable install true)
(let [r (sh (str install))]
(println (:out r))
(println (:err r))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment