spk rev 5

Add: lib/libspk.sh and up README
author Christophe Lincoln <pankso@slitaz.org>
date Fri May 11 16:28:54 2012 +0200 (2012-05-11)
parents 18c3408dec16
children df253a909464
files README lib/libspk.sh
line diff
     1.1 --- a/README	Fri May 11 10:00:39 2012 -0500
     1.2 +++ b/README	Fri May 11 16:28:54 2012 +0200
     1.3 @@ -8,15 +8,16 @@
     1.4  Spk
     1.5  -------------------------------------------------------------------------------
     1.6  Spk is the main tool to handle and play with SliTaz packages, it handles multiple
     1.7 -packages on cmdline and a wide range of --options which will perform tasks such as
     1.8 -adding or removing packages using the toolset. Spk itself provides some small
     1.9 +packages on cmdline and a wide range of --options which will perform tasks such
    1.10 +as adding or removing packages using the toolset. Spk itself provides some small
    1.11  commands such as ls or info.
    1.12  
    1.13  
    1.14  Toolset
    1.15  -------------------------------------------------------------------------------
    1.16  Spk is separated in many small tools following the UNIX philosophy: one tool for
    1.17 -one task but do that task well. Here is a list of proposal tools and ther functions:
    1.18 +one task but do that task well. Here is a list of proposal tools and ther
    1.19 +functions:
    1.20  
    1.21  	* spk-add    : Install local or online pkgs
    1.22  	* spk-rm     : Remove packages: confirm in option ?
    1.23 @@ -25,11 +26,17 @@
    1.24  	* spk-archive: Manage pacakge extraction, compression, and packing
    1.25  	* spk-mirror : Manage mirrors and undigest
    1.26  
    1.27 +
    1.28  LibSpk
    1.29  -------------------------------------------------------------------------------
    1.30 +Libspk provide base function and internal variables used my almost all spk-tools.
    1.31 +
    1.32 +	* Source: libtaz.sh, libpkg.sh, slitaz.conf
    1.33 +	* Internal Spk variables (lowercase, not configurable)
    1.34  	* Display package info
    1.35  	* ...
    1.36  
    1.37 +
    1.38  Devnotes
    1.39  -------------------------------------------------------------------------------
    1.40  Some random and usefull notes.
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/lib/libspk.sh	Fri May 11 16:28:54 2012 +0200
     2.3 @@ -0,0 +1,43 @@
     2.4 +#!/bin/sh
     2.5 +#
     2.6 +# Libspk - The Spk base function and internal variables used my almost all
     2.7 +# spk-tools. Read the README before adding or modifing any code in spk!
     2.8 +#
     2.9 +# Copyright (C) SliTaz GNU/Linux - BSD License
    2.10 +# Author: See AUTHORS files
    2.11 +#
    2.12 +. /lib/libtaz.sh
    2.13 +. /usr/lib/slitaz/libpkg.sh
    2.14 +. /etc/slitaz/slitaz.conf
    2.15 +
    2.16 +# Internal variables.
    2.17 +mirrorurl="$PKGS_DB/mirror"
    2.18 +installed="$PKGS_DB/installed"
    2.19 +pkgsdesc="$PKGS_DB/packages.desc"
    2.20 +pkgsmd5="$PKGS_DB/packages.md5"
    2.21 +blocked="$PKGS_DB/blocked-packages.list"
    2.22 +
    2.23 +#
    2.24 +# Functions
    2.25 +#
    2.26 +
    2.27 +# Display receipt information.
    2.28 +receipt_info() {
    2.29 +	cat << EOT
    2.30 +$(gettext "Version    :") ${VERSION}${EXTRAVERSION}
    2.31 +$(gettext "Short desc :") $SHORT_DESC
    2.32 +$(gettext "Category   :") $CATEGORY
    2.33 +EOT
    2.34 +}
    2.35 +
    2.36 +# Used by: list
    2.37 +count_installed() {
    2.38 +	count=$(ls $installed | wc -l)
    2.39 +	gettext "Installed packages"; echo ": $count"
    2.40 +}
    2.41 +
    2.42 +# Used by: list
    2.43 +count_mirrored() {
    2.44 +	count=$(cat $pkgsmd5 | wc -l)
    2.45 +	gettext "Mirrored packages"; echo ": $count"
    2.46 +}