1
0
Fork 0

start setup of jetbrains toolbox download

master
Florian Schrofner 2023-12-01 16:28:38 +01:00
parent a319bed149
commit a739ccf140
1 changed files with 27 additions and 1 deletions

View File

@ -1,12 +1,24 @@
#!/usr/bin/env bb
(require
'[babashka.fs :as fs]
'[clojure.tools.cli :refer [parse-opts]]
'[clojure.string :as string])
;;todo: import from base.clj
(defn- safe-sh [& commands]
(as-> (apply shell/sh commands) $
(if (= (:exit $) 0) $ (throw (Exception. (:err $))))))
(def cli-options
[["-u" "--user USER" "The user to set up"]])
(def options (:options (parse-opts *command-line-args* cli-options)))
(def user (:user options))
(def home (str "/home/" user))
(def packages {
:base ["bluez" "chromium" "emacs-gtk3" "fish-shell" "firefox" "flatpak" "git" "pass" "ranger"]
:base ["bluez" "chromium" "emacs-gtk3" "fish-shell" "firefox" "flatpak" "git" "htop" "pass" "ranger" "thunar-archive-plugin" "wget" "xarchiver"]
:work ["kotlin-bin" "scrcpy"]
})
@ -14,6 +26,8 @@
:work ["com.getpostman.Postman" "com.slack.Slack"]
})
(def toolbox-link "https://download.jetbrains.com/toolbox/jetbrains-toolbox-2.1.1.18388.tar.gz")
;;todo: allow to pick specific package sets later
;;installing normal xbps packages
@ -28,3 +42,15 @@
(let [packages-to-install (flatten (vals flatpak-packages))]
(apply safe-sh (concat ["flatpak" "install" "flathub" "--noninteractive"] packages-to-install)))
(println "flatpak packages installed")
;;installing jetbrains toolbox
(println "installing jetbrains toolbox..")
(let [download-file (str home "/Downloads/toolbox.tar.gz")
target-directory (str home "/Applications/JetbrainsToolbox")]
(safe-sh "wget" "-O" download-file toolbox-link)
(fs/delete-tree target-directory)
(fs/create-dirs target-directory)
(fs/gunzip download-file target-directory {:replace-existing true})
(fs/delete (fs/file download-file))
(safe-sh "chown" (str user ":" user) "-R" target-directory))
(println "jetbrains toolbox installed")