wok-6.x view get-xcas/stuff/get-xcas @ rev 15566
Up: thunderbird-langpack-sv_SE (17.0.11esr)
author | Dominique Corbex <domcox@slitaz.org> |
---|---|
date | Sun Nov 24 17:37:52 2013 +0100 (2013-11-24) |
parents | 023a32bce7dd |
children |
line source
1 #!/bin/sh -e
3 PACKAGE="xcas"
4 WEB_SITE="http://www-fourier.ujf-grenoble.fr/~parisse/giac.html"
5 CATEGORY="misc"
6 SHORT_DESC="Computer algebra system"
7 MAINTAINER="bernard.parisse@ujf-grenoble.fr"
8 DEPENDS=""
9 URL=http://www-fourier.ujf-grenoble.fr/~parisse/giac/xcas.tgz
11 ROOT="$1"
12 [ -d "$ROOT" ] || ROOT=""
14 if test $(id -u) != 0 ; then
15 echo -e "\nYou must be root to run `basename $0`."
16 echo -e "Please type 'su' and root password to become super-user.\n"
17 exit 0
18 fi
20 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
21 [ -n "$ROOT" ] && exit 1
22 tazpkg remove $PACKAGE
23 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
24 fi
26 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
27 CUR_DIR=$(pwd)
28 mkdir -p $TMP_DIR && cd $TMP_DIR
30 # Download tarball
31 FILE=$(basename $URL)
32 wget $URL
34 if [ ! -f $FILE ]; then
35 cd $CUR_DIR
36 rm -rf $TMP_DIR
37 echo "Could not download $FILE from $URL. Exiting."
38 exit 1
39 fi
41 XCAS_BASE=/usr/local
42 mkdir -p $PACKAGE/fs$XCAS_BASE $PACKAGE/fs/usr/bin
43 tar xzf $FILE -C $PACKAGE/fs$XCAS_BASE || true
44 # extracted pkg can be removed: Save RAM
45 rm -f $FILE
47 cat > $PACKAGE/fs/usr/bin/$PACKAGE << EOT
48 #!/bin/sh
50 export LD_LIBRARY_PATH=$XCAS_BASE/lib:/lib:/usr/lib
51 export XCAS_HELP=$XCAS_BASE/share/giac
52 export XCAS_ROOT=$XCAS_BASE/bin
53 \$XCAS_ROOT/xcas \$@
54 EOT
55 chmod +x $PACKAGE/fs/usr/bin/$PACKAGE
57 VERSION="$(sed '/^VERSION/!d;s/.*= //' \
58 $PACKAGE/fs$XCAS_BASE/share/giac/examples/Exemples/Makefile)"
60 mv $PACKAGE $PACKAGE-$VERSION
61 cd $PACKAGE-$VERSION/fs
63 # Create menu
64 mkdir -p usr/share/applications
65 cat > usr/share/applications/$PACKAGE.desktop <<EOT
66 [Desktop Entry]
67 Version=1.0
68 Encoding=UTF-8
69 Name=$PACKAGE
70 Exec=$PACKAGE
71 Terminal=false
72 Categories=Application
73 Icon=$XCAS_BASE/share/giac//doc/en/tutoriel/img8.png
74 Comment=$SHORT_DESC
75 Type=Application
76 Categories=Office;
77 EOT
78 cd ../..
80 cat > $PACKAGE-$VERSION/receipt <<EOT
81 PACKAGE="$PACKAGE"
82 VERSION="$VERSION"
83 CATEGORY="$CATEGORY"
84 SHORT_DESC="$SHORT_DESC"
85 MAINTAINER="$MAINTAINER"
86 DEPENDS="$DEPENDS"
87 WEB_SITE="$WEB_SITE"
88 EOT
90 # Pack
91 tazpkg pack $PACKAGE-$VERSION
93 # Clean to save RAM memory
94 rm -rf $PACKAGE-$VERSION
96 # Install pseudo package
97 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
98 case " $@ " in
99 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
100 esac
102 # Clean
103 cd $CUR_DIR
104 rm -rf $TMP_DIR