wok view get-wink/stuff/get-wink @ rev 16481
xpaint: clean up packaged files
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Wed Apr 23 03:43:46 2014 +0200 (2014-04-23) |
parents | 32959e7975fc |
children |
line source
1 #!/bin/sh -e
3 ROOT="$1"
4 PACKAGE=${0#*get-}
6 if test $(id -u) != 0 ; then
7 echo -e "\nYou must be root to run `basename $0`."
8 echo -e "Please type 'su' and root password to become super-user.\n"
9 exit 0
10 fi
12 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
13 [ -n "$ROOT" ] && exit 1
14 tazpkg remove $PACKAGE
15 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
16 fi
17 [ -d $ROOT/usr/share/$PACKAGE ] && rm -rf $ROOT/usr/share/$PACKAGE
19 dl_urls()
20 {
21 wget -O - http://www.debugmode.com/wink/download.php 2> /dev/null | \
22 grep gz | sed 's/.*<a href=\(.*\)gz>.*/\1gz/'
23 }
25 WEB_SITE="http://www.debugmode.com/wink/"
27 TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
28 CUR_DIR=$(pwd)
29 mkdir -p $TMP_DIR && cd $TMP_DIR
31 # Download tarball
32 for i in $(dl_urls); do
33 TARBALL=$(basename $i)
34 wget $i && break
35 done
36 if [ ! -f $TARBALL ]; then
37 cd $CUR_DIR
38 rm -rf $TMP_DIR
39 echo "Could not download $TARBALL. Exiting."
40 exit 1
41 fi
43 VERSION=${TARBALL%.*}
44 VERSION=${VERSION%.tar}
45 VERSION=${VERSION#wink}
47 # Extract
48 tar xzf $TARBALL
50 # extracted pkg can be removed: Save RAM
51 rm -rf $TARBALL
53 # Install files
54 mkdir -p $PACKAGE-$VERSION/fs/usr/share/$PACKAGE $PACKAGE-$VERSION/fs/usr/bin
55 tar xzf installdata.tar.gz -C $PACKAGE-$VERSION/fs/usr/share/$PACKAGE
56 cat > $PACKAGE-$VERSION/fs/usr/bin/$PACKAGE <<EOT
57 #!/bin/sh
58 exec $PACKAGE-$VERSION/fs/usr/share/$PACKAGE/$PACKAGE "$@"
59 EOT
60 chmod +x $PACKAGE-$VERSION/fs/usr/bin/$PACKAGE
62 # Create pseudo package
63 cat > $PACKAGE-$VERSION/receipt <<EOT
64 # SliTaz package receipt.
66 PACKAGE="$PACKAGE"
67 VERSION="$VERSION"
68 CATEGORY="non-free"
69 SHORT_DESC="Tutorial and Presentation creation software."
70 WEB_SITE="$WEB_SITE"
71 DEPENDS="gtk+ atk pango glib xorg-libXi xorg-libXext xorg-libX11 libstdc++5"
72 EOT
74 # Pack
75 tazpkg pack $PACKAGE-$VERSION
77 # Clean to save RAM memory
78 rm -rf $PACKAGE-$VERSION
80 # Install pseudo package
81 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
83 # Clean
84 cd $CUR_DIR
85 rm -rf $TMP_DIR