Last active
December 1, 2021 19:00
-
-
Save donthorp/3358aac2a9cc272dd8332a055e17cc8b to your computer and use it in GitHub Desktop.
Script for updating Babashka on Pop OS (Ubuntu) using Babashka
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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