Created
August 16, 2015 14:11
-
-
Save brownman/a181d394d415c82f1f02 to your computer and use it in GitHub Desktop.
This file contains 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 | |
set -e | |
export WRAPPER="`readlink -f "$0"`" | |
HERE="`dirname "$WRAPPER"`" | |
. $HERE/../lib/utils.sh | |
. $HERE/../lib/os.sh | |
EAP=0 | |
echo $* | grep eap > /dev/null && EAP=1 | |
which wget > /dev/null || os.pkmgr.install wget | |
os.pkmgr.is_apt && { | |
which update-java-alternatives > dev/null || update-java-alternatives -l | grep 7-oracle > /dev/null || { | |
utils.warn "PhpStorm requires Oracle Java 7 or higher. Installing Oracle Java 7.". | |
utils.warn "To install version 8 or higher, please alter the script's content... " | |
utils.warn "(please press any key to continue, Ctrl+C to quit)" | |
read x | |
bash $HERE/../java.sh oracle java7 | |
} | |
} | |
utils.info "Installing Jetbrains WebStorm ..."; | |
if [ "x1" == "x`ls -la /opt | grep WebStorm | wc -l`" ]; then | |
utils.warn "WebStorm already exists. Upgrading... (please press any key to continue, Ctrl+C to quit)"; | |
read x; | |
fi | |
url=`wget https://www.jetbrains.com/webstorm/download/download_thanks.jsp?os=linux -q -O - | grep HTTP | grep href | grep tar.gz | sed "s/<a/\n/g" | tail -n 2 | head -n 1 | awk -F '"' '{print $2}'`; | |
[ "x$EAP" == "x1" ] && { | |
url=$(wget "https://confluence.jetbrains.com/display/WI/WebStorm+EAP" -q -O - | grep external | grep tar.gz | head -n 1 | awk -F '"' '{print $2}'); | |
} | |
utils.info "Downloading $url to /opt ..."; | |
wget "$url" -O /opt/webstorm.tar.gz; | |
cd /opt && rm -rf WebStorm* && tar -xzf webstorm.tar.gz; | |
utils.info "Creating symlinks ..."; | |
rm -rf /usr/bin/webstorm && ln -s /opt/WebStorm*/bin/webstorm.sh /usr/bin/webstorm || { | |
utils.error "Could not create symlinks!"; | |
} | |
utils.info "Creating application desktop icon ..." | |
ICON=$(ls /opt/WebStorm*/bin/webide.png) | |
cat > /usr/share/applications/jetbrains-webstorm.desktop <<WEBSTORM_DESKTOP | |
[Desktop Entry] | |
Name=WebStorm | |
Comment=WebStorm | |
GenericName=Smart Code Editor | |
Exec=/usr/bin/webstorm | |
Icon=$ICON | |
Type=Application | |
StartupNotify=true | |
Categories=GNOME;GTK;Utility;TextEditor;Development; | |
MimeType=text/plain; | |
WEBSTORM_DESKTOP | |
rm -rf /opt/webstorm*gz | |
utils.info "Done."; | |
exit 0; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment