Skip to content

Instantly share code, notes, and snippets.

@darthgelum
Last active November 20, 2023 10:28
Show Gist options
  • Select an option

  • Save darthgelum/e8573246e70ef022690e57065f57caf2 to your computer and use it in GitHub Desktop.

Select an option

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"
#!/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

Copy link
Copy Markdown
Author
  1. Download tar.gz from JetBrains site
  2. Change $intellijproduct to the required (idea, clion, goland etc)
  3. Save script near archive for automatic find or choose 2 and enter path to it
  4. PROFIT!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment