Skip to content

Commit

Permalink
feat: jetbrains-toolbox
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevithakannan2 committed Oct 31, 2024
1 parent 4577df4 commit f6aa44e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 0 deletions.
48 changes: 48 additions & 0 deletions core/tabs/applications-setup/Developer-tools/jetbrains-toolbox.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/dash -e

. ../../common-script.sh

Check warning on line 3 in core/tabs/applications-setup/Developer-tools/jetbrains-toolbox.sh

View workflow job for this annotation

GitHub Actions / Shellcheck

[shellcheck] reported by reviewdog 🐶 Not following: ../../common-script.sh: openBinaryFile: does not exist (No such file or directory) Raw Output: ./core/tabs/applications-setup/Developer-tools/jetbrains-toolbox.sh:3:3: info: Not following: ../../common-script.sh: openBinaryFile: does not exist (No such file or directory) (ShellCheck.SC1091)

manualInstall() {
JETBRAINS_TOOLBOX_DIR="/opt/jetbrains-toolbox"

case "$ARCH" in
x86_64) ARCHIVE_URL=$(curl -s "https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release" | jq -r ".TBA[0].downloads.linux.link");;
aarch64) ARCHIVE_URL=$(curl -s "https://data.services.jetbrains.com/products/releases?code=TBA&latest=true&type=release" | jq -r ".TBA[0].downloads.linuxARM64.link");;
esac

curl -fSL "$ARCHIVE_URL" -o "jetbrains-toolbox.tar.gz"

if [ -d "$JETBRAINS_TOOLBOX_DIR" ]; then
"$ESCALATION_TOOL" rm -rf "$JETBRAINS_TOOLBOX_DIR"
fi

"$ESCALATION_TOOL" mkdir -p "$JETBRAINS_TOOLBOX_DIR"
"$ESCALATION_TOOL" tar -xzf "jetbrains-toolbox.tar.gz" -C "$JETBRAINS_TOOLBOX_DIR" --strip-components=1
"$ESCALATION_TOOL" ln -sf "$JETBRAINS_TOOLBOX_DIR/jetbrains-toolbox" "/usr/bin/jetbrains-toolbox"
}

installJetBrainsToolBox() {
if ! command_exists jetbrains-toolbox; then
printf "%b\n" "${YELLOW}Installing Jetbrains Toolbox...${RC}"
case "$PACKAGER" in
pacman)
"$AUR_HELPER" -S --needed --noconfirm jetbrains-toolbox
;;
dnf)
manualInstall
;;
*)
"$ESCALATION_TOOL" "$PACKAGER" install -y libfuse2
manualInstall
;;
esac
printf "%b\n" "${GREEN}Successfully installed Jetbrains Toolbox.${RC}"
else
printf "%b\n" "${GREEN}Jetbrains toolbox is already installed.${RC}"
fi
}

checkEnv
checkEscalationTool
checkAURHelper
installJetBrainsToolBox
6 changes: 6 additions & 0 deletions core/tabs/applications-setup/tab_data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ description = "GitHub Desktop is a user-friendly application that simplifies the
script = "Developer-tools/githubdesktop-setup.sh"
task_list = "I"

[[data.entries]]
name = "JetBrains Toolbox"
description = "JetBrains Toolbox is a collection of tools and an app that help developers work with JetBrains products."
script = "Developer-tools/jetbrains-toolbox.sh"
task_list = "I"

[[data.entries]]
name = "Meld"
description = "Meld is a visual diff and merge tool that helps compare files, directories, and version-controlled projects."
Expand Down
11 changes: 11 additions & 0 deletions core/tabs/common-script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ command_exists() {
return 0
}

checkArch() {
case "$(uname -m)" in
x86_64|amd64) ARCH="x86_64" ;;
aarch64|arm64) ARCH="aarch64" ;;
*) printf "%b\n" "${RED}Unsupported architecture: $(uname -m)${RC}" && exit 1 ;;
esac

printf "%b\n" "${CYAN}System architecture: ${ARCH}${RC}"
}

checkAURHelper() {
## Check & Install AUR helper
if [ "$PACKAGER" = "pacman" ]; then
Expand Down Expand Up @@ -128,6 +138,7 @@ checkDistro() {
}

checkEnv() {
checkArch
checkEscalationTool
checkCommandRequirements "curl groups $ESCALATION_TOOL"
checkPackageManager 'nala apt-get dnf pacman zypper'
Expand Down

0 comments on commit f6aa44e

Please sign in to comment.