wok view get-eclipse-pdt/stuff/get-eclipse-pdt @ rev 2821

Add lcms (Light color management)
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 29 21:19:45 2009 +0200 (2009-04-29)
parents 9ae047db7ddd
children 32959e7975fc
line source
1 #!/bin/sh
2 # get-eclipse-pdt, get and install Eclipse PHP Development tool.
3 #
4 # (C) 2008 SliTaz - GNU General Public License v3.
5 #
6 # Author : Eric Joseph-Alexandre <erjo@slitaz.org>
8 PACKAGE="eclipse-pdt"
9 VERSION="1.0.3"
10 URL="http://www.eclipse.org"
11 TARBALL="pdt-all-in-one-linux-gtk-${VERSION}.tar.gz"
12 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"
13 TEMP_DIR="/home/slitaz/build/$PACKAGE.$$"
14 SOURCE_DIR="/home/slitaz/src"
15 LOG="/tmp/$(basename $0 .sh).log"
16 ROOT="$1"
18 # Status function with color (supported by Ash).
19 status()
20 {
21 local CHECK=$?
22 echo -en "\\033[70G[ "
23 if [ $CHECK = 0 ]; then
24 echo -en "\\033[1;33mOK"
25 else
26 echo -en "\\033[1;31mFailed"
27 fi
28 echo -e "\\033[0;39m ]"
29 return $CHECK
30 }
32 # Check if user is root to install, or remove packages.
33 check_root()
34 {
35 if test $(id -u) != 0 ; then
36 echo -e "\nYou must be root to run `basename $0` with this option."
37 echo -e "Please use 'su' and root password to become super-user.\n"
38 exit 0
39 fi
40 }
42 check_if_installed()
43 {
44 # Avoid reinstall
45 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ];then
46 return 1
47 else
48 return 0
49 fi
50 }
52 #We need to bee root
53 check_root
55 #check if package already installed
56 if (check_if_installed $PACKAGE); then
57 echo "$PACKAGE is already installed."
58 [ -n "$ROOT" ] && exit 0
59 echo -n "Would you like to remove and reinstall this package [y/n]? "
60 read answer
61 case "$answer" in
62 y|Y)
63 tazpkg remove $PACKAGE ;;
64 *)
65 exit 0 ;;
66 esac
68 fi
71 # Check if we have the tarball before.
72 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
73 echo "Downloading $PACKAGE tarball (it's time to have a break)... "
74 #Check if $SOURCE_DIR exist
75 test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
76 # Get the file.
77 wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
78 status
79 fi
83 # Creates TEM_DIR and extract tarball
84 mkdir -p $TEMP_DIR
85 echo -n "Extract files from archive..."
86 tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \
87 (echo "Failed to extract $TARBALL" ; exit 1)
88 status
91 cd $TEMP_DIR
93 # Make the package
94 mkdir -p $PACKAGE-$VERSION/fs/usr/lib \
95 $PACKAGE-$VERSION/fs/usr/share/pixmaps \
96 $PACKAGE-$VERSION/fs/usr/share/applications
98 cp -a eclipse $PACKAGE-$VERSION/fs/usr/lib/
99 cp -a eclipse/icon.xpm $PACKAGE-$VERSION/fs/usr/share/pixmaps/eclipse.xpm
101 # Create .desktop file
102 cat >> $PACKAGE-$VERSION/fs/usr/share/applications/$PACKAGE.desktop <<EOF
103 [Desktop Entry]
104 Type=Application
105 Version=1.0
106 Name=Eclipse
107 Name[fr]=Eclipse
108 GenericName=Eclipse Integrated Development Environment
109 GenericName[fr]=Environnement de Développement Eclipse
110 Comment=PHP Development Tools
111 Comment[fr]=Outils de developpement PHP
112 Exec=/usr/lib/eclipse/eclipse
113 Icon=eclipse.xpm
114 Terminal=false
115 Categories=GTK;Development;IDE;
116 StartupNotify=true
117 EOF
118 # Create receipt
119 cat > $PACKAGE-$VERSION/receipt <<EOT
120 # SliTaz package receipt.
122 PACKAGE="$PACKAGE"
123 VERSION="$VERSION"
124 CATEGORY="development"
125 SHORT_DESC="PHP Development Tools"
126 WEB_SITE="$URL"
128 EOT
130 # Pack
131 tazpkg pack $PACKAGE-$VERSION
133 # Install pseudo package
134 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
136 # Clean
137 rm -rf $TEMP_DIR
138 rm -rf $PACKAGE-$VERSION