-(ns utils
+(ns debian
(:require [clojure.string :as str]
[clojure.java.io :as io]
[cheshire.core :as json]
[org.httpkit.client :as http]
[lib :refer [download-binary run-cmd]]))
-(defn git-pull-rebase-branch
- "Do git pull and rebase branch with master"
- []
- (let [current-branch (str/trim (run-cmd ["git" "branch" "--show-current"]))]
- (print (run-cmd ["git" "pull" "--rebase"]))
- (when (not (contains? #{"master" "main"} current-branch))
- (run! print
- (map run-cmd
- '[["git" "checkout" "master"] ["git" "pull" "--rebase"]
- ["git" "checkout" "-"] ["git" "rebase" "master"]])))))
-
-(defn run-seq
- "Run a sequence of shell commands on a sequence of arguments.
-
- Examples:
-
- 1. Play and delete each video from a folder
- ls | bb -i '(run-seq [\"mpv\" \"rm\"] *input*)'
- "
- [commands arguments]
- (doseq [argument arguments
- command commands]
- (println (run-cmd [command argument]))))
-
-(defn install-deb
+(defn install-deb-from-url
"Install a Debian package given a direct URL to the .deb file."
[url]
(println "Downloading deb package...")
assets (get-assets api-url)
deb-url (find-url-to-deb assets)]
;; Download and install Debian package
- (install-deb deb-url))))
+ (install-deb-from-url deb-url))))