Last active
November 20, 2023 10:28
-
-
Save darthgelum/e8573246e70ef022690e57065f57caf2 to your computer and use it in GitHub Desktop.
Automating script for installing JetBrains products on Linux distributons from official ".tar.gz"
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
| #!/bin/bash | |
| # idea|clion|datagrip etc. | |
| intellijproduct="idea" | |
| tarfile="" | |
| attempt=$(find . -iname "*$intellijproduct*.gz") | |
| uresp="" | |
| if [ "$attempt" != "" ]; then | |
| echo "" | |
| echo "Available options:" | |
| echo "" | |
| echo "1) $(pwd)/$attempt" | |
| echo "2) Input path manually" | |
| printf "\nChoose an option (1,2): " | |
| read uresp | |
| fi | |
| if [[ "$uresp" == "2" || "$attempt" == " " ]]; then | |
| echo "Input path:" | |
| read tarfile | |
| else | |
| tarfile=$attempt | |
| fi | |
| echo "using $tarfile" | |
| echo "" | |
| sudo tar -xvf $tarfile -C /opt/ | |
| install_path=$(find /opt/ -maxdepth 1 -type d -iname "*$intellijproduct*") | |
| sudo mv $install_path /opt/$intellijproduct$(date '+%d%m%M%S') | |
| install_path=$(find /opt/ -maxdepth 1 -type d -iname "*$intellijproduct*") | |
| echo $install_path | |
| sudo chown $USER $install_path | |
| icon="/usr/share/applications/$intellijproduct.desktop" | |
| sudo touch $icon | |
| sudo chown $USER $icon | |
| printf "[Desktop Entry] | |
| Encoding=UTF-8 | |
| Name=$(python3 -c "import sys, json; f = open(r\"$install_path/product-info.json\"); print(json.load(f)['name'])") | |
| Comment=$(python3 -c "import sys, json; f = open(r\"$install_path/product-info.json\"); print(json.load(f)['name'])") | |
| Exec=$install_path/$(python3 -c "import sys, json; f = open(r\"$install_path/product-info.json\"); print(json.load(f)['launch'][0]['launcherPath'])") | |
| Icon=$install_path/$(python3 -c "import sys, json; f = open(r\"$install_path/product-info.json\"); print(json.load(f)['svgIconPath'])") | |
| Terminal=false | |
| StartupNotify=true | |
| Categories=TextEditor;Development;IDE; | |
| Type=Application" > $icon | |
| printf "\nCongratulations! Successfully installed!\n" |
darthgelum
commented
Sep 28, 2021
Author
- Download tar.gz from JetBrains site
- Change $intellijproduct to the required (idea, clion, goland etc)
- Save script near archive for automatic find or choose 2 and enter path to it
- PROFIT!!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment