Last active
March 25, 2017 12:39
-
-
Save betrcode/f868a6afad77d43598064e65b0dd37e8 to your computer and use it in GitHub Desktop.
Installs IntelliJ from tar.gz file on Ubuntu
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 | |
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!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Wrote this for myself. Got tired of manually "installing" IntelliJ.