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

updated jsoncpp (0.10.2 -> 1.8.4)
author Hans-G?nter Theisgen
date Fri Mar 15 15:55:06 2019 +0100 (2019-03-15)
parents e5dde73f1ac9
children
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
81 if [ ! -f $SOURCE_DIR/$TARBALL ]; then
82 rm -rf $TEMP_DIR
83 rm -rf $PACKAGE-$VERSION
84 echo "Could not download $TARBALL. Exiting."
85 exit 1
86 fi
88 # Creates TEM_DIR and extract tarball
89 mkdir -p $TEMP_DIR
90 echo -n "Extract files from archive..."
91 tar xvzf $SOURCE_DIR/$TARBALL -C $TEMP_DIR > $LOG 2>&1 || \
92 (echo "Failed to extract $TARBALL" ; exit 1)
93 status
95 # extracted pkg can be removed: Save RAM
96 rm -rf $SOURCE_DIR/$TARBALL
98 cd $TEMP_DIR
100 # Make the package
101 mkdir -p $PACKAGE-$VERSION/fs/usr/lib \
102 $PACKAGE-$VERSION/fs/usr/share/pixmaps \
103 $PACKAGE-$VERSION/fs/usr/share/applications
105 # use mv instead of 'cp -a' to save RAM
106 mv eclipse $PACKAGE-$VERSION/fs/usr/lib/
107 mv eclipse/icon.xpm $PACKAGE-$VERSION/fs/usr/share/pixmaps/eclipse.xpm
109 # Create .desktop file
110 cat >> $PACKAGE-$VERSION/fs/usr/share/applications/$PACKAGE.desktop <<EOF
111 [Desktop Entry]
112 Type=Application
113 Version=1.0
114 Name=Eclipse
115 Name[fr]=Eclipse
116 GenericName=Eclipse Integrated Development Environment
117 GenericName[fr]=Environnement de Développement Eclipse
118 Comment=PHP Development Tools
119 Comment[fr]=Outils de developpement PHP
120 Exec=/usr/lib/eclipse/eclipse
121 Icon=eclipse
122 Terminal=false
123 Categories=GTK;Development;IDE;
124 StartupNotify=true
125 EOF
126 # Create receipt
127 cat > $PACKAGE-$VERSION/receipt <<EOT
128 # SliTaz package receipt.
130 PACKAGE="$PACKAGE"
131 VERSION="$VERSION"
132 CATEGORY="development"
133 SHORT_DESC="PHP Development Tools"
134 WEB_SITE="$URL"
136 EOT
138 # Pack
139 tazpkg pack $PACKAGE-$VERSION
141 # Clean to save RAM memory
142 rm -rf $PACKAGE-$VERSION
144 # Install pseudo package
145 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
147 # Clean
148 rm -rf $TEMP_DIR
149 rm -rf $PACKAGE-$VERSION