wok-current view get-upx/stuff/get-upx @ rev 21920
Add pcem
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sat Oct 05 16:15:48 2019 +0200 (2019-10-05) |
parents | afe3762cd9dc |
children |
line source
1 #!/bin/sh -e
3 ROOT="$1"
4 WEB_SITE="http://upx.sourceforge.net/"
5 SUF="i386_linux.tar.bz2"
6 VERSION=$(wget -O - $WEB_SITE | grep "$SUF\"" | sed "s|.*upx-\(.*\)-$SUF.*|\1|")
7 TARBALL="upx-$VERSION-$SUF"
8 WGET_URL="${WEB_SITE}download/$TARBALL"
10 if test $(id -u) != 0 ; then
11 echo -e "\nYou must be root to run `basename $0`."
12 echo -e "Please type 'su' and root password to become super-user.\n"
13 exit 0
14 fi
16 if [ -d $ROOT/var/lib/tazpkg/installed/upx ]; then
17 [ -n "$ROOT" ] && exit 1
18 tazpkg remove upx
19 [ -d /var/lib/tazpkg/installed/upx ] && exit 1
20 fi
22 BASE=$PWD
23 DIR=/tmp/$0-$$
24 mkdir -p $DIR
25 cd $DIR
27 # Download tarball
28 wget $WGET_URL
29 if [ ! -f $TARBALL ]; then
30 cd $BASE
31 rm -rf $DIR
32 echo "Could not download $TARBALL. Exiting."
33 exit 1
34 fi
36 # Extract
37 tar xjf $TARBALL
39 # extracted pkg can be removed: Save RAM before packing
40 rm -rf $TARBALL
42 # Install files
43 dir=upx-$VERSION/fs/usr/bin
44 mkdir -p $dir
45 mv upx-$VERSION-i386_linux/upx $dir
47 # Create pseudo package
48 cat > upx-$VERSION/receipt <<EOT
49 PACKAGE="upx"
50 VERSION="$VERSION"
51 CATEGORY="non-free"
52 SHORT_DESC="Executable packer for several different executable formats."
53 WEB_SITE="$WEB_SITE"
54 EOT
56 # Pack
57 tazpkg pack upx-$VERSION
59 # Clean to save RAM memory
60 rm -rf upx-$VERSION
62 # Install pseudo package
63 tazpkg install upx-$VERSION.tazpkg --root=$ROOT
64 cd $BASE
66 # Clean
67 rm -rf $DIR $TARBALL