summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
96c0531)
Signed-off-by: Joseph Nuthalapati <njoseph@riseup.net>
'[org.httpkit.client :as http]
'[babashka.fs :as fs]
'[clojure.java.io :as io]
'[org.httpkit.client :as http]
'[babashka.fs :as fs]
'[clojure.java.io :as io]
- '[lib :refer [download-binary expand-home extract-file-from-zip]])
+ '[lib :refer [download-binary expand-home run-cmd]])
(defn babashka-latest-version
[]
(defn babashka-latest-version
[]
(defn check-latest
[version]
(defn check-latest
[version]
(defn update-babashka
[]
(let [architecture "linux-amd64" ;; TODO support other architectures
(defn update-babashka
[]
(let [architecture "linux-amd64" ;; TODO support other architectures
- zip-file "babashka.zip"
- destination (expand-home "~/bin/bb")
+ tarball "babashka.tar.gz"
+ destination (expand-home "~/bin")
version (babashka-latest-version)]
(println (str "Latest version is " version))
(check-latest version)
(println "Updating...")
version (babashka-latest-version)]
(println (str "Latest version is " version))
(check-latest version)
(println "Updating...")
- (download-latest version architecture zip-file)
- (extract-file-from-zip zip-file "bb" destination)
- (fs/set-posix-file-permissions destination "rwxr-xr-x")
- (io/delete-file zip-file)
+ (download-latest version architecture tarball)
+ (run-cmd ["tar" "-xzf" tarball "--directory" destination])
+ (fs/set-posix-file-permissions (str destination "/bb") "rwxr-xr-x")
+ (io/delete-file tarball)
(println "Done!")))
(when (= *file* (System/getProperty "babashka.file")) (update-babashka))
(println "Done!")))
(when (= *file* (System/getProperty "babashka.file")) (update-babashka))