Skip to content

Instantly share code, notes, and snippets.

@betrcode
Last active March 25, 2017 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save betrcode/f868a6afad77d43598064e65b0dd37e8 to your computer and use it in GitHub Desktop.
Save betrcode/f868a6afad77d43598064e65b0dd37e8 to your computer and use it in GitHub Desktop.
Installs IntelliJ from tar.gz file on Ubuntu
#!/bin/bash
cd ~
default_download_dir=$(cat $HOME/.config/user-dirs.dirs | grep XDG_DOWNLOAD_DIR= | awk -F '=' '{print $2}' | tr -d '"')
echo "Default download dir is: ${default_download_dir}"
download_dir=${1:-$default_download_dir}
download_dir=$(eval echo $download_dir) # Expand environment variables
echo "Searching for the latest idea*.tar.gz in download dir: ${download_dir}"
idea_file=$(ls -1 --sort=time ${download_dir}/ideaIU-*.tar.gz | head -n 1)
idea_filename=$(basename ${idea_file})
echo "Found: ${idea_file}"
echo "Filename: ${idea_filename}"
echo "Copy archive to ~"
cp ${idea_file} ~
echo "Unpack archive"
tar -xzf ${idea_filename}
new_folder=$(ls -1 -d --sort=time idea-I*/ | head -n 1)
echo "Archive unpacked to: ${new_folder}"
echo "Remove archive"
rm ${idea_filename}
echo "Create ~/idea symlink to ${new_folder}"
rm -f idea # Remove any old symlink
ln -s ${new_folder} idea
new_folder_full_path=$(readlink -f idea)
echo "Create desktop entry"
cat <<EOF > ~/.local/share/applications/jetbrains-idea.desktop
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=${new_folder_full_path}/bin/idea.png
Exec="${new_folder_full_path}/bin/idea.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea
EOF
echo "New IntelliJ installed in ${new_folder} with a symlink '~/idea' "
echo "Start IntelliJ using: '~/idea/bin/idea.sh &'"
echo "...or just click the updated launchbar button!"
@betrcode
Copy link
Author

Wrote this for myself. Got tired of manually "installing" IntelliJ.

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