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

clamav: update BUILD_DEPENDS
author Paul Issott <paul@slitaz.org>
date Sun Nov 16 17:19:15 2008 +0000 (2008-11-16)
parents
children e01dd228942a
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"
17 # Status function with color (supported by Ash).
18 status()
19 {
20 local CHECK=$?
21 echo -en "\\033[70G[ "
22 if [ $CHECK = 0 ]; then
23 echo -en "\\033[1;33mOK"
24 else
25 echo -en "\\033[1;31mFailed"
26 fi
27 echo -e "\\033[0;39m ]"
28 return $CHECK
29 }
31 # Check if user is root to install, or remove packages.
32 check_root()
33 {
34 if test $(id -u) != 0 ; then
35 echo -e "\nYou must be root to run `basename $0` with this option."
36 echo -e "Please use 'su' and root password to become super-user.\n"
37 exit 0
38 fi
39 }
41 check_if_installed()
42 {
43 # Avoid reinstall
44 if [ -d /var/lib/tazpkg/installed/$PACKAGE ];then
45 return 1
46 else
47 return 0
48 fi
49 }
51 #We need to bee root
52 check_root
54 #check if package already installed
55 if (check_if_installed $PACKAGE); then
56 echo "$PACKAGE is already installed."
57 echo -n "Would you like to remove and reinstall this package [y/n]? "
58 read answer
59 case "$answer" in
60 y|Y)
61 tazpkg remove $PACKAGE ;;
62 *)
63 exit 0 ;;
64 esac
66 fi
69 # Check if we have the tarball before.
70 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
71 echo "Downloading $PACKAGE tarball (it's time to have a break)... "
72 #Check if $SOURCE_DIR exist
73 test -d $SOURCE_DIR || mkdir -p $SOURCE_DIR
74 # Get the file.
75 wget -c $WGET_URL -O $SOURCE_DIR/$TARBALL
76 status
77 fi
81 # Creates TEM_DIR and extract tarball
82 mkdir -p $TEMP_DIR
83 echo -n "Extract files from archive..."
84 tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \
85 (echo "Failed to extract $TARBALL" ; exit 1)
86 status
89 cd $TEMP_DIR
91 # Make the package
92 mkdir -p $PACKAGE-$VERSION/fs/usr/lib \
93 $PACKAGE-$VERSION/fs/usr/share/pixmaps \
94 $PACKAGE-$VERSION/fs/usr/share/applications
96 cp -a eclipse $PACKAGE-$VERSION/fs/usr/lib/
97 cp -a eclipse/icon.xpm $PACKAGE-$VERSION/fs/usr/share/pixmaps/eclipse.xpm
99 # Create .desktop file
100 cat >> $PACKAGE-$VERSION/fs/usr/share/applications/$PACKAGE.desktop <<EOF
101 [Desktop Entry]
102 Type=Application
103 Version=1.0
104 Name=Eclipse
105 Name[fr]=Eclipse
106 GenericName=Eclipse Integrated Development Environment
107 GenericName[fr]=Environnement de Développement Eclipse
108 Comment=PHP Development Tools
109 Comment[fr]=Outils de developpement PHP
110 Exec=/usr/lib/eclipse/eclipse
111 Icon=eclipse.xpm
112 Terminal=false
113 Categories=GTK;Development;IDE;
114 StartupNotify=true
115 EOF
116 # Create receipt
117 cat > $PACKAGE-$VERSION/receipt <<EOT
118 # SliTaz package receipt.
120 PACKAGE="$PACKAGE"
121 VERSION="$VERSION"
122 CATEGORY="development"
123 SHORT_DESC="PHP Development Tools"
124 WEB_SITE="$URL"
126 EOT
128 # Pack
129 tazpkg pack $PACKAGE-$VERSION
131 # Install pseudo package
132 tazpkg install $PACKAGE-$VERSION.tazpkg
134 # Clean
135 rm -rf $TEMP_DIR
136 rm -rf $PACKAGE-$VERSION