wok rev 11549

Add get-nz form wok-undigest
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Dec 25 15:18:56 2011 +0100 (2011-12-25)
parents 88f64a860eaf
children 99241084b602
files get-nz/receipt get-nz/stuff/get-nz
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/get-nz/receipt	Sun Dec 25 15:18:56 2011 +0100
     1.3 @@ -0,0 +1,16 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="get-nz"
     1.7 +VERSION="1.00"
     1.8 +CATEGORY="non-free"
     1.9 +SHORT_DESC="Get nanozip archiver."
    1.10 +MAINTAINER="pascal.bellard@slitaz.org"
    1.11 +WEB_SITE="http://www.nanozip.net/"
    1.12 +
    1.13 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.14 +genpkg_rules()
    1.15 +{
    1.16 +	mkdir -p $fs/usr/bin
    1.17 +	cp stuff/get-nz $fs/usr/bin
    1.18 +}
    1.19 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/get-nz/stuff/get-nz	Sun Dec 25 15:18:56 2011 +0100
     2.3 @@ -0,0 +1,65 @@
     2.4 +#!/bin/sh -e
     2.5 +
     2.6 +PACKAGE="nz"
     2.7 +WGET_URL="http://nanozip.net/"
     2.8 +SHORT_DESC="Experimental file archiver"
     2.9 +ROOT="$1"
    2.10 +[ -d "$ROOT" ] || ROOT=""
    2.11 +
    2.12 +if test $(id -u) != 0 ; then
    2.13 +        echo -e "\nYou must be root to run `basename $0`."
    2.14 +        echo -e "Please type 'su' and root password to become super-user.\n"
    2.15 +        exit 0
    2.16 +fi
    2.17 +
    2.18 +if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    2.19 +	[ -n "$ROOT" ] && exit 1
    2.20 +	tazpkg remove $PACKAGE
    2.21 +	[ -d /var/lib/tazpkg/installed/$PACKAGE ] && exit 1
    2.22 +fi
    2.23 +
    2.24 +TMP_DIR=/tmp/get-$PACKAGE-$$-$RANDOM
    2.25 +CUR_DIR=$(pwd)
    2.26 +mkdir -p $TMP_DIR && cd $TMP_DIR
    2.27 +
    2.28 +VERSION="$(wget -O - http://nanozip.net/download.html | sed 's/>/>\n/g' | \
    2.29 +           sed '/linux32/!d;s/.*href=nanozip-\(.*\).linux32.*/\1/;q')"
    2.30 +TARBALL="nanozip-$VERSION.linux32.zip"
    2.31 +wget ${WGET_URL}$TARBALL
    2.32 +
    2.33 +if [ ! -f $TARBALL ]; then
    2.34 +	cd $CUR_DIR
    2.35 +	rm -rf $TMP_DIR
    2.36 +	echo "Could not download $TARBALL from $WGET_URL. Exiting."
    2.37 +	exit 1
    2.38 +fi
    2.39 +
    2.40 +unzip $TARBALL nz
    2.41 +mkdir -p $PACKAGE-$VERSION/fs/usr/bin
    2.42 +chmod +x nz
    2.43 +mv nz $PACKAGE-$VERSION/fs/usr/bin
    2.44 +
    2.45 +cat > $PACKAGE-$VERSION/receipt <<EOT
    2.46 +PACKAGE="$PACKAGE"
    2.47 +VERSION="$VERSION"
    2.48 +CATEGORY="non-free"
    2.49 +SHORT_DESC="$SHORT_DESC"
    2.50 +WEB_SITE="$WEB_SITE"
    2.51 +EOT
    2.52 +
    2.53 +# Pack
    2.54 +tazpkg pack $PACKAGE-$VERSION
    2.55 +
    2.56 +# Clean to save RAM memory
    2.57 +rm -rf $PACKAGE-$VERSION
    2.58 +
    2.59 +# Install pseudo package
    2.60 +tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
    2.61 +case " $@ " in
    2.62 +*\ --k*) mv $PACKAGE-$VERSION.tazpkg $CUR_DIR ;;
    2.63 +esac
    2.64 +
    2.65 +# Clean
    2.66 +cd $CUR_DIR
    2.67 +rm -rf $TMP_DIR
    2.68 +