wok rev 1699

Add: get-eclipse-pdt, get and install eclipse PDT
author Eric Joseph-Alexandre <erjo@slitaz.org>
date Thu Nov 13 00:04:59 2008 +0100 (2008-11-13)
parents 81afad9999f9
children 678fb7df7545
files get-eclipse-pdt/receipt get-eclipse-pdt/stuff/get-eclipse-pdt
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/get-eclipse-pdt/receipt	Thu Nov 13 00:04:59 2008 +0100
     1.3 @@ -0,0 +1,16 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="get-eclipse-pdt"
     1.7 +VERSION="1.0"
     1.8 +CATEGORY="cwdevelopment"
     1.9 +SHORT_DESC="PEclipse PHP Development Tools"
    1.10 +MAINTAINER="erjo@slitaz.org"
    1.11 +WEB_SITE="http://www.eclipse.org"
    1.12 +
    1.13 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.14 +genpkg_rules()
    1.15 +{
    1.16 +	mkdir -p $fs/usr/bin
    1.17 +	install -o root -g root -m755 stuff/get-* $fs/usr/bin
    1.18 +}
    1.19 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/get-eclipse-pdt/stuff/get-eclipse-pdt	Thu Nov 13 00:04:59 2008 +0100
     2.3 @@ -0,0 +1,136 @@
     2.4 +#!/bin/sh
     2.5 +# get-eclipse-pdt, get and install Eclipse PHP Development tool.
     2.6 +#
     2.7 +# (C) 2008 SliTaz - GNU General Public License v3.
     2.8 +#
     2.9 +# Author : Eric Joseph-Alexandre <erjo@slitaz.org>
    2.10 +
    2.11 +PACKAGE="eclipse-pdt"
    2.12 +VERSION="1.0.3"
    2.13 +URL="http://www.eclipse.org"
    2.14 +TARBALL="pdt-all-in-one-linux-gtk-${VERSION}.tar.gz"
    2.15 +WGET_URL="http://www.eclipse.org/downloads/download.php?file=/tools/pdt/downloads/drops/1.0.3/R200806030000/pdt-all-in-one-linux-gtk-1.0.3.tar.gz&url=http://eclipse.ialto.org/tools/pdt/downloads/drops/1.0.3/R200806030000/${TARBALL}&mirror_id=514"
    2.16 +TEMP_DIR="/home/slitaz/build/$PACKAGE.$$"
    2.17 +SOURCE_DIR="/home/slitaz/src"
    2.18 +LOG="/tmp/$(basename $0 .sh).log"
    2.19 +
    2.20 +# Status function with color (supported by Ash).
    2.21 +status()
    2.22 +{
    2.23 +	local CHECK=$?
    2.24 +	echo -en "\\033[70G[ "
    2.25 +	if [ $CHECK = 0 ]; then
    2.26 +		echo -en "\\033[1;33mOK"
    2.27 +	else
    2.28 +		echo -en "\\033[1;31mFailed"
    2.29 +	fi
    2.30 +	echo -e "\\033[0;39m ]"
    2.31 +	return $CHECK
    2.32 +}
    2.33 +
    2.34 +# Check if user is root to install, or remove packages.
    2.35 +check_root()
    2.36 +{
    2.37 +	if test $(id -u) != 0 ; then
    2.38 +		echo -e "\nYou must be root to run `basename $0` with this option."
    2.39 +		echo -e "Please use 'su' and root password to become super-user.\n"
    2.40 +		exit 0
    2.41 +	fi
    2.42 +}
    2.43 +
    2.44 +check_if_installed()
    2.45 +{
    2.46 +	 # Avoid reinstall
    2.47 +	 if [ -d /var/lib/tazpkg/installed/$PACKAGE ];then
    2.48 +	 	return 1
    2.49 +	 else
    2.50 +	 	return 0
    2.51 +	 fi
    2.52 +}
    2.53 +
    2.54 +#We need to bee root
    2.55 +check_root
    2.56 +
    2.57 +#check if package already installed
    2.58 +if (check_if_installed $PACKAGE); then
    2.59 +	echo "$PACKAGE is already installed."
    2.60 +	echo -n "Would you like to remove and reinstall this package [y/n]? "
    2.61 +	read answer
    2.62 +	case "$answer" in
    2.63 +	y|Y)
    2.64 +		tazpkg remove $PACKAGE ;;
    2.65 +	*)
    2.66 +		exit 0 ;;
    2.67 +	esac
    2.68 +		
    2.69 +fi
    2.70 +
    2.71 +
    2.72 +# Check if we have the tarball before.
    2.73 +if [ ! -f $SOURCE_DIR/$TARBALL ]; then
    2.74 +	echo "Downloading $PACKAGE tarball (it's time to have a break)... "
    2.75 +	#Check if $SOURCE_DIR exist
    2.76 +	test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
    2.77 +	# Get the file.
    2.78 +	wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
    2.79 +	status
    2.80 +fi
    2.81 +
    2.82 +
    2.83 +
    2.84 +# Creates TEM_DIR and extract tarball
    2.85 +mkdir -p $TEMP_DIR
    2.86 +echo -n "Extract files from archive..."
    2.87 +tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \
    2.88 + (echo "Failed to extract $TARBALL" ; exit 1)
    2.89 +status
    2.90 +
    2.91 +
    2.92 +cd $TEMP_DIR
    2.93 +	
    2.94 +# Make the package
    2.95 +mkdir -p $PACKAGE-$VERSION/fs/usr/lib  \
    2.96 +  $PACKAGE-$VERSION/fs/usr/share/pixmaps \
    2.97 +  $PACKAGE-$VERSION/fs/usr/share/applications
    2.98 + 
    2.99 +cp -a eclipse $PACKAGE-$VERSION/fs/usr/lib/
   2.100 +cp -a eclipse/icon.xpm $PACKAGE-$VERSION/fs/usr/share/pixmaps/eclipse.xpm
   2.101 +
   2.102 +# Create .desktop file
   2.103 +cat >>  $PACKAGE-$VERSION/fs/usr/share/applications/$PACKAGE.desktop <<EOF
   2.104 +[Desktop Entry]
   2.105 +Type=Application
   2.106 +Version=1.0
   2.107 +Name=Eclipse
   2.108 +Name[fr]=Eclipse
   2.109 +GenericName=Eclipse Integrated Development Environment
   2.110 +GenericName[fr]=Environnement de Développement Eclipse
   2.111 +Comment=PHP Development Tools
   2.112 +Comment[fr]=Outils de developpement PHP
   2.113 +Exec=/usr/lib/eclipse/eclipse
   2.114 +Icon=eclipse.xpm
   2.115 +Terminal=false
   2.116 +Categories=GTK;Development;IDE;
   2.117 +StartupNotify=true
   2.118 +EOF
   2.119 +# Create receipt
   2.120 +cat > $PACKAGE-$VERSION/receipt <<EOT
   2.121 +# SliTaz package receipt.
   2.122 +
   2.123 +PACKAGE="$PACKAGE"
   2.124 +VERSION="$VERSION"
   2.125 +CATEGORY="development"
   2.126 +SHORT_DESC="PHP Development Tools"
   2.127 +WEB_SITE="$URL"
   2.128 +
   2.129 +EOT
   2.130 +
   2.131 +# Pack
   2.132 +tazpkg pack $PACKAGE-$VERSION
   2.133 +
   2.134 +# Install pseudo package
   2.135 +tazpkg install $PACKAGE-$VERSION.tazpkg
   2.136 +
   2.137 +# Clean
   2.138 +rm -rf $TEMP_DIR
   2.139 +rm -rf $PACKAGE-$VERSION