wok-stable view get-rar/stuff/get-rar @ rev 8028
up: xfdesktop* (4.8.0)
author | Eric Joseph-Alexandre <erjo@slitaz.org> |
---|---|
date | Thu Jan 20 02:18:47 2011 +0100 (2011-01-20) |
parents | 32959e7975fc |
children |
line source
1 #!/bin/sh -e
3 ROOT="$1"
4 PACKAGE="rar"
5 WEB_SITE="http://www.rarlab.com/"
6 WGET_URL="${WEB_SITE}download.htm"
8 if test $(id -u) != 0 ; then
9 echo -e "\nYou must be root to run `basename $0`."
10 echo -e "Please type 'su' and root password to become super-user.\n"
11 exit 0
12 fi
14 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
15 [ -n "$ROOT" ] && exit 1
16 tazpkg remove $PACKAGE
17 [ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
18 fi
20 WGET_URL=$WEB_SITE$(wget -O - $WGET_URL | grep 'rarlinux-[0-9]' | sed 's/.*href="\(.*\)".*/\1/')
21 TARBALL=$(basename $WGET_URL || true)
22 VERSION=$(echo $TARBALL | sed 's/.*-\(.*\).tar.*/\1/')
23 echo "Downloading $PACKAGE $VERSION from $WGET_URL..."
25 BASE=$PWD
26 DIR=/tmp/$0-$$
27 mkdir -p $DIR
28 cd $DIR
30 # Download tarball
31 wget $WGET_URL
32 if [ ! -f $TARBALL ]; then
33 cd $BASE
34 rm -rf $DIR
35 echo "Could not download $TARBALL. Exiting."
36 exit 1
37 fi
39 # Extract
40 tar xzf $TARBALL
42 # Install files
43 dir=$PACKAGE-$VERSION/fs/usr/bin
44 mkdir -p $dir
45 mv rar*/rar rar*/unrar $dir
47 # extracted pkg can be removed: Save RAM
48 rm -f $TARBALL
50 # Create pseudo package
51 cat > $PACKAGE-$VERSION/receipt <<EOT
52 PACKAGE="$PACKAGE"
53 VERSION="$VERSION"
54 CATEGORY="non-free"
55 SHORT_DESC="A powerful archive manager."
56 WEB_SITE="$WEB_SITE"
57 EOT
59 # Pack
60 tazpkg pack $PACKAGE-$VERSION
62 # Clean to save RAM memory
63 rm -rf $PACKAGE-$VERSION
65 # Install pseudo package
66 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
67 cd $BASE
69 # Clean
70 rm -rf $DIR