slitaz-tools rev 575

Add stuff folder for old and unused stuff
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 29 16:12:11 2011 +0200 (2011-04-29)
parents 735dced6a1c2
children 0a7ab48dfe8c
files stuff/README stuff/tazfile tinyutils/tazfile
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/stuff/README	Fri Apr 29 16:12:11 2011 +0200
     1.3 @@ -0,0 +1,5 @@
     1.4 +
     1.5 +
     1.6 +Some old stuff we had used in SliTaz. We keep thes files, code, etc since
     1.7 +they may have good things we will reuse on day.
     1.8 +
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/stuff/tazfile	Fri Apr 29 16:12:11 2011 +0200
     2.3 @@ -0,0 +1,140 @@
     2.4 +#!/bin/sh
     2.5 +# Tazfile - Tiny autonomus zone files locator.
     2.6 +#
     2.7 +# This is a lightweight files locator for *.tazpkg files written in
     2.8 +# SHell script. It works well with Busybox ash shell and bash. Tazfile lets you
     2.9 +# create and explore a files list database.
    2.10 +#
    2.11 +# (C) 2008 SliTaz - GNU General Public License v3.
    2.12 +#
    2.13 +# Author : Pascal Bellard <pascal.bellard@slitaz.org>
    2.14 +#
    2.15 +VERSION=1.0
    2.16 +
    2.17 +####################
    2.18 +# Script variables #
    2.19 +####################
    2.20 +
    2.21 +# Initialize some variables to use words
    2.22 +# rather than numbers for functions and actions.
    2.23 +COMMAND=$1
    2.24 +TOP_DIR=`pwd`
    2.25 +TMP_DIR=/tmp/tazfile-$$-$RANDOM
    2.26 +
    2.27 +# Path to tazpkg used dir and configuration files
    2.28 +LOCALSTATE=/var/lib/tazpkg
    2.29 +INSTALLED=$LOCALSTATE/installed
    2.30 +MIRROR=$LOCALSTATE/mirror
    2.31 +FILES_LIST=$LOCALSTATE/files.list.lzma
    2.32 +DEFAULT_MIRROR="http://download.tuxfamily.org/slitaz/packages/`cat /etc/slitaz-release`/"
    2.33 +
    2.34 +# Check if the directories and files used by Tazfile
    2.35 +# exist. If not and user is root we create them.
    2.36 +if test $(id -u) = 0 ; then
    2.37 +	if [ ! -d "$INSTALLED" ]; then
    2.38 +		mkdir -p $INSTALLED
    2.39 +	fi
    2.40 +	if [ ! -f "$LOCALSTATE/mirror" ]; then
    2.41 +		echo "$DEFAULT_MIRROR" > $LOCALSTATE/mirror
    2.42 +	fi
    2.43 +fi
    2.44 +
    2.45 +####################
    2.46 +# Script functions #
    2.47 +####################
    2.48 +
    2.49 +# Print the usage.
    2.50 +usage ()
    2.51 +{
    2.52 +	echo -e "SliTaz files locator - Version: $VERSION\n
    2.53 +\033[1mUsage:\033[0m tazfile [command] [file...]\n
    2.54 +\033[1mCommands: \033[0m
    2.55 +  usage            Print this short usage.
    2.56 +  build            Build a files list to stdout from a list of packages.  
    2.57 +  recharge         Recharge your $(basename $FILES_LIST) from the mirror.
    2.58 +  search	   Search for file(s) in all (installed or not) packages.
    2.59 +
    2.60 +\033[1mExample: \033[0m
    2.61 +  $ find . -name '*.tazpkg' | tazfile build > $(basename $FILES_LIST)
    2.62 +  $ tazfile recharge
    2.63 +  $ tazfile search awk cpio "  
    2.64 +}
    2.65 +
    2.66 +# Check for packages.list to download and install packages.
    2.67 +check_for_files_list_lzma()
    2.68 +{
    2.69 +	if [ ! -f "$FILES_LIST" ]; then
    2.70 +		echo -e "
    2.71 +Unable to find the list : $FILES_LIST\n
    2.72 +You must probably run 'tazfile recharge' as root to get the latest list of 
    2.73 +files available on the mirror.\n"
    2.74 +		exit 0
    2.75 +	fi
    2.76 +}
    2.77 +
    2.78 +# Download a file trying all mirrors
    2.79 +download()
    2.80 +{
    2.81 +	for i in $(cat $MIRROR); do
    2.82 +		wget $i$@ && break
    2.83 +	done
    2.84 +}
    2.85 +
    2.86 +build_database()
    2.87 +{
    2.88 +        while read pkg; do
    2.89 +                cat $pkg | ( cd $TMP_DIR
    2.90 +                        cpio -iu > /dev/null 2>&1
    2.91 +                        . ./receipt
    2.92 +                        echo "$PACKAGE"
    2.93 +                        cat ./files.list ) | awk '
    2.94 +                            BEGIN { name="" }
    2.95 +                            {
    2.96 +                                if (name == "") name=$0;
    2.97 +                                else printf("%s: %s\n",name,$0);
    2.98 +                            }'
    2.99 +        done
   2.100 +}
   2.101 +
   2.102 +###################
   2.103 +# Tazpkg commands #
   2.104 +###################
   2.105 +
   2.106 +case "$COMMAND" in
   2.107 +	build)
   2.108 +		# Create files.list.lzma to stdout.
   2.109 +		#
   2.110 +		mkdir $TMP_DIR
   2.111 +		build_database | lzma e -si -so
   2.112 +		rm -rf $TMP_DIR
   2.113 +		;;
   2.114 +	recharge)
   2.115 +		# Recharge files.list.lzma from a mirror.
   2.116 +		#
   2.117 +		cd $LOCALSTATE
   2.118 +		echo ""
   2.119 +		mv -f $FILES_LIST $FILES_LIST.old 2> /dev/null
   2.120 +		download $(basename $FILES_LIST)
   2.121 +		;;
   2.122 +	search)
   2.123 +		# Search for a file by pattern or name in files.list.lzma.
   2.124 +		#
   2.125 +		check_for_files_list_lzma
   2.126 +		while [ -n "$2" ]; do
   2.127 +			unlzma -c $FILES_LIST | \
   2.128 +				grep -i -- "$2$" | while read line; do
   2.129 +					pkg=${line%:*}
   2.130 +					if [ -d $INSTALLED/$pkg ]; then
   2.131 +						echo -n "[already installed]  "
   2.132 +					fi
   2.133 +					echo "$line"
   2.134 +				done
   2.135 +			shift
   2.136 +		done
   2.137 +		;;
   2.138 +	usage|*)
   2.139 +		# Print a short help or give usage for an unknown or empty command.
   2.140 +		#
   2.141 +		usage
   2.142 +		;;
   2.143 +esac
     3.1 --- a/tinyutils/tazfile	Fri Apr 29 13:39:58 2011 +0200
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,140 +0,0 @@
     3.4 -#!/bin/sh
     3.5 -# Tazfile - Tiny autonomus zone files locator.
     3.6 -#
     3.7 -# This is a lightweight files locator for *.tazpkg files written in
     3.8 -# SHell script. It works well with Busybox ash shell and bash. Tazfile lets you
     3.9 -# create and explore a files list database.
    3.10 -#
    3.11 -# (C) 2008 SliTaz - GNU General Public License v3.
    3.12 -#
    3.13 -# Author : Pascal Bellard <pascal.bellard@slitaz.org>
    3.14 -#
    3.15 -VERSION=1.0
    3.16 -
    3.17 -####################
    3.18 -# Script variables #
    3.19 -####################
    3.20 -
    3.21 -# Initialize some variables to use words
    3.22 -# rather than numbers for functions and actions.
    3.23 -COMMAND=$1
    3.24 -TOP_DIR=`pwd`
    3.25 -TMP_DIR=/tmp/tazfile-$$-$RANDOM
    3.26 -
    3.27 -# Path to tazpkg used dir and configuration files
    3.28 -LOCALSTATE=/var/lib/tazpkg
    3.29 -INSTALLED=$LOCALSTATE/installed
    3.30 -MIRROR=$LOCALSTATE/mirror
    3.31 -FILES_LIST=$LOCALSTATE/files.list.lzma
    3.32 -DEFAULT_MIRROR="http://download.tuxfamily.org/slitaz/packages/`cat /etc/slitaz-release`/"
    3.33 -
    3.34 -# Check if the directories and files used by Tazfile
    3.35 -# exist. If not and user is root we create them.
    3.36 -if test $(id -u) = 0 ; then
    3.37 -	if [ ! -d "$INSTALLED" ]; then
    3.38 -		mkdir -p $INSTALLED
    3.39 -	fi
    3.40 -	if [ ! -f "$LOCALSTATE/mirror" ]; then
    3.41 -		echo "$DEFAULT_MIRROR" > $LOCALSTATE/mirror
    3.42 -	fi
    3.43 -fi
    3.44 -
    3.45 -####################
    3.46 -# Script functions #
    3.47 -####################
    3.48 -
    3.49 -# Print the usage.
    3.50 -usage ()
    3.51 -{
    3.52 -	echo -e "SliTaz files locator - Version: $VERSION\n
    3.53 -\033[1mUsage:\033[0m tazfile [command] [file...]\n
    3.54 -\033[1mCommands: \033[0m
    3.55 -  usage            Print this short usage.
    3.56 -  build            Build a files list to stdout from a list of packages.  
    3.57 -  recharge         Recharge your $(basename $FILES_LIST) from the mirror.
    3.58 -  search	   Search for file(s) in all (installed or not) packages.
    3.59 -
    3.60 -\033[1mExample: \033[0m
    3.61 -  $ find . -name '*.tazpkg' | tazfile build > $(basename $FILES_LIST)
    3.62 -  $ tazfile recharge
    3.63 -  $ tazfile search awk cpio "  
    3.64 -}
    3.65 -
    3.66 -# Check for packages.list to download and install packages.
    3.67 -check_for_files_list_lzma()
    3.68 -{
    3.69 -	if [ ! -f "$FILES_LIST" ]; then
    3.70 -		echo -e "
    3.71 -Unable to find the list : $FILES_LIST\n
    3.72 -You must probably run 'tazfile recharge' as root to get the latest list of 
    3.73 -files available on the mirror.\n"
    3.74 -		exit 0
    3.75 -	fi
    3.76 -}
    3.77 -
    3.78 -# Download a file trying all mirrors
    3.79 -download()
    3.80 -{
    3.81 -	for i in $(cat $MIRROR); do
    3.82 -		wget $i$@ && break
    3.83 -	done
    3.84 -}
    3.85 -
    3.86 -build_database()
    3.87 -{
    3.88 -        while read pkg; do
    3.89 -                cat $pkg | ( cd $TMP_DIR
    3.90 -                        cpio -iu > /dev/null 2>&1
    3.91 -                        . ./receipt
    3.92 -                        echo "$PACKAGE"
    3.93 -                        cat ./files.list ) | awk '
    3.94 -                            BEGIN { name="" }
    3.95 -                            {
    3.96 -                                if (name == "") name=$0;
    3.97 -                                else printf("%s: %s\n",name,$0);
    3.98 -                            }'
    3.99 -        done
   3.100 -}
   3.101 -
   3.102 -###################
   3.103 -# Tazpkg commands #
   3.104 -###################
   3.105 -
   3.106 -case "$COMMAND" in
   3.107 -	build)
   3.108 -		# Create files.list.lzma to stdout.
   3.109 -		#
   3.110 -		mkdir $TMP_DIR
   3.111 -		build_database | lzma e -si -so
   3.112 -		rm -rf $TMP_DIR
   3.113 -		;;
   3.114 -	recharge)
   3.115 -		# Recharge files.list.lzma from a mirror.
   3.116 -		#
   3.117 -		cd $LOCALSTATE
   3.118 -		echo ""
   3.119 -		mv -f $FILES_LIST $FILES_LIST.old 2> /dev/null
   3.120 -		download $(basename $FILES_LIST)
   3.121 -		;;
   3.122 -	search)
   3.123 -		# Search for a file by pattern or name in files.list.lzma.
   3.124 -		#
   3.125 -		check_for_files_list_lzma
   3.126 -		while [ -n "$2" ]; do
   3.127 -			unlzma -c $FILES_LIST | \
   3.128 -				grep -i -- "$2$" | while read line; do
   3.129 -					pkg=${line%:*}
   3.130 -					if [ -d $INSTALLED/$pkg ]; then
   3.131 -						echo -n "[already installed]  "
   3.132 -					fi
   3.133 -					echo "$line"
   3.134 -				done
   3.135 -			shift
   3.136 -		done
   3.137 -		;;
   3.138 -	usage|*)
   3.139 -		# Print a short help or give usage for an unknown or empty command.
   3.140 -		#
   3.141 -		usage
   3.142 -		;;
   3.143 -esac