Skip to content

Instantly share code, notes, and snippets.

@ee08b397
Created April 14, 2016 14:19
Show Gist options
  • Save ee08b397/3af632ad805bc7f49391079f58a03565 to your computer and use it in GitHub Desktop.
Save ee08b397/3af632ad805bc7f49391079f58a03565 to your computer and use it in GitHub Desktop.
install eclipse
#!/bin/sh
# http://blog.brunobraga.net/eclipse-42-in-ubuntu-1204/
ECLIPSE=/usr/lib/eclipse/eclipse
inject_update_site(){
if [ ! -e "$1" ] ; then
echo "W: Cannot find $1" 2>&1
return 1
fi
cat - >>"$1" <<EOF
repositories/http\:__download.eclipse.org_releases_indigo/enabled=true
repositories/http\:__download.eclipse.org_releases_indigo/isSystem=false
repositories/http\:__download.eclipse.org_releases_indigo/nickname=Indigo Update Site
repositories/http\:__download.eclipse.org_releases_indigo/uri=http\://download.eclipse.org/releases/ indigo/
EOF
}
if [ ! -d ~/.eclipse/ ] ; then
$ECLIPSE -clean -initialize || exit $?
artifact=$(find ~/.eclipse \
-regex .*/profileRegistry/.*/org.eclipse.equinox.p2.artifact.repository.prefs)
metadata=$(find ~/.eclipse \
-regex .*/profileRegistry/.*/org.eclipse.equinox.p2.metadata.repository.prefs)
if [ -z "$artifact" ] || [ -z "$metadata" ]; then
echo "W: Cannot inject update-sites, cannot find the correct config." 2>&1
else
( inject_update_site "$artifact" && \
inject_update_site "$metadata" && \
echo "I: Injected update sites" ) || echo "W: Could not inject update sites." 2>&1
fi
fi
exec $ECLIPSE "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment