wok-6.x view get-algobox/stuff/get-algobox @ rev 16198
Up: pidgin (2.10.9) due to security issues
author | Alexander Medvedev <devl547@gmail.com> |
---|---|
date | Sun Mar 30 21:11:56 2014 +0000 (2014-03-30) |
parents | |
children | 666b1da48c97 |
line source
1 #!/bin/sh -e
3 PACKAGE="algobox"
4 WEB_SITE="http://www.xm1math.net/algobox/"
5 CATEGORY="misc"
6 SHORT_DESC="Algorithm creation tool for education"
7 DEPENDS="libQtWebkit libQtXml libQtGui libQtCore gcc-lib-base"
8 URL="${WEB_SITE}download.html"
10 ROOT="$1"
11 [ -d "$ROOT" ] || ROOT=""
13 if test $(id -u) != 0 ; then
14 echo -e "\nYou must be root to run `basename $0`."
15 echo -e "Please type 'su' and root password to become super-user.\n"
16 exit 0
17 fi
19 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
20 [ -n "$ROOT" ] && exit 1
21 tazpkg remove $PACKAGE
22 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
23 fi
25 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
26 CUR_DIR=$(pwd)
27 mkdir -p $TMP_DIR && cd $TMP_DIR
29 URL="$WEB_SITE$(wget -O - sed '/debian_wheezy_i386/!d;s/.*href=.\([^"]*\).*/\1/')"
30 FILE="$(basename $URL)"
32 # Download deb
33 wget -O $FILE $URL
35 if [ ! -f $FILE ]; then
36 cd $CUR_DIR
37 rm -rf $TMP_DIR
38 echo "Could not download $FILE from $URL. Exiting."
39 exit 1
40 fi
42 mkdir $PACKAGE
43 dpkg-deb -e $FILE $PACKAGE/meta
44 dpkg-deb -x $FILE $PACKAGE/fs
45 # extracted pkg can be removed: Save RAM
46 rm -f $FILE
47 if ! grep -q "insert long description" $PACKAGE/meta/control ; then
48 sed '/^Description:/,$!d;s/^Description://' \
49 < $PACKAGE/meta/control > $PACKAGE/description.txt
50 SHORT_DESC="$(sed '/^Description:/!d;s/.*: //' $PACKAGE/meta/control)"
51 if
53 MAINTAINER="$(sed '/^Maintainer:/!d;s/.*: //' $PACKAGE/meta/control)"
54 VERSION="$(sed '/^Version:/!d;s/.*: //' $PACKAGE/meta/control)"
55 mv $PACKAGE $PACKAGE-$VERSION
57 cat > $PACKAGE-$VERSION/receipt <<EOT
58 PACKAGE="$PACKAGE"
59 VERSION="$VERSION"
60 CATEGORY="$CATEGORY"
61 SHORT_DESC="$SHORT_DESC"
62 MAINTAINER="$MAINTAINER"
63 DEPENDS="$DEPENDS"
64 WEB_SITE="$WEB_SITE"
65 EOT
67 # Pack
68 tazpkg pack $PACKAGE-$VERSION
70 # Clean to save RAM memory
71 rm -rf $PACKAGE-$VERSION
73 # Install pseudo package
74 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
75 case " $@ " in
76 *\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
77 esac
79 # Clean
80 cd $CUR_DIR
81 rm -rf $TMP_DIR