Skip to content

Instantly share code, notes, and snippets.

@dair-targ
Created July 19, 2016 02:40
Show Gist options
  • Save dair-targ/f631d77c982e168e2a1a7c84bb695fbd to your computer and use it in GitHub Desktop.
Save dair-targ/f631d77c982e168e2a1a7c84bb695fbd to your computer and use it in GitHub Desktop.
Install IntelliJ IDEA on Ubuntu
#!/bin/bash
set -e -o pipefail
# TODO: .local/share/applications/jetbrains-idea.desktop
echo >/dev/null <<_JETBRAINS_IDEA_DESKTOP
[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA
Icon=/home/vladimirb/Documents/Applications/idea/bin/idea.png
Exec="/home/vladimirb/Documents/Applications/idea/bin/idea.sh" %f
Comment=Develop with pleasure!
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea
_JETBRAINS_IDEA_DESKTOP
DOWNLOADS="${HOME}/Downloads"
APPLICATIONS="${HOME}/Documents/Applications"
if [[ -z $1 ]]
then
IDEA_ARCHIVE="${DOWNLOADS}/"$(ls -c1 "${DOWNLOADS}" | head -n 1)
else
IDEA_ARCHIVE="${1}"
fi
echo "${IDEA_ARCHIVE}"
mkdir -p "${APPLICATIONS}"
cp "${IDEA_ARCHIVE}" "${APPLICATIONS}"
cd "${APPLICATIONS}"
echo "Extracting..."
tar xvfz "${APPLICATIONS}"/$(basename "${IDEA_ARCHIVE}") 1>/dev/null 2>&1
IDEA_DIR=${APPLICATIONS}/$(ls -c1 "${APPLICATIONS}" | head -n 1)
echo "Refresing link: idea -> ${IDEA_DIR}"
rm ${APPLICATIONS}/idea
ln ${IDEA_DIR} -s ${APPLICATIONS}/idea
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment