tazpkg rev 931

Add module/bb: manage Busybox applets.
Remove function definitions that are now in the /lib/libtaz.sh (die, im).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sun Jan 08 11:24:12 2017 +0200 (2017-01-08)
parents ecbca6dbf6fb
children d08b638af430
files modules/bb modules/description modules/getenv modules/info modules/list modules/remove
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/modules/bb	Sun Jan 08 11:24:12 2017 +0200
     1.3 @@ -0,0 +1,45 @@
     1.4 +#!/bin/sh
     1.5 +# TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
     1.6 +# bb - TazPkg module
     1.7 +# Manage Busybox applets
     1.8 +
     1.9 +
    1.10 +# Input: $1 - command:
    1.11 +#    restore   restore missing Busybox applets
    1.12 +#    replaced  list of the replaced Busybox applets
    1.13 +#
    1.14 +# Variable $root points to the root of the installation
    1.15 +
    1.16 +
    1.17 +# Connect function libraries
    1.18 +. /lib/libtaz.sh
    1.19 +
    1.20 +
    1.21 +
    1.22 +
    1.23 +[ ! -x "$root/bin/busybox" ] && die 'Busybox is not installed in the %s. Exit.' "$root"
    1.24 +
    1.25 +# Full list but skipping some applets: bbconfig, linuxrc
    1.26 +applets_list=$($root/bin/busybox --list-full | grep -v 'bbconfig\|linuxrc')
    1.27 +
    1.28 +case $1 in
    1.29 +	restore)
    1.30 +		mkdir -p "$root/sbin" "$root/usr/bin" "$root/usr/sbin"
    1.31 +		for applet in $applets_list; do
    1.32 +			if [ ! -x "$root/$applet" ]; then
    1.33 +				action 'Restoring Busybox applet %s...' "$(basename $applet)"
    1.34 +				case $(dirname $applet) in
    1.35 +					bin)      ln -sf           'busybox' "$root/$applet";;
    1.36 +					sbin)     ln -sf    '../bin/busybox' "$root/$applet";;
    1.37 +					usr/*bin) ln -sf '../../bin/busybox' "$root/$applet";;
    1.38 +				esac
    1.39 +				status
    1.40 +			fi
    1.41 +		done
    1.42 +		;;
    1.43 +	replaced)
    1.44 +		ls -l $(echo "$applets_list" | sed "s|^|$root/|") 2>/dev/null | \
    1.45 +		awk -vr="$root" '{if ($0 !~ /busybox$/){sub(r, ""); print $9}}'
    1.46 +		;;
    1.47 +esac
    1.48 +
     2.1 --- a/modules/description	Sat Jan 07 09:06:14 2017 +0000
     2.2 +++ b/modules/description	Sun Jan 08 11:24:12 2017 +0200
     2.3 @@ -13,13 +13,6 @@
     2.4  
     2.5  
     2.6  
     2.7 -# Interactive mode
     2.8 -
     2.9 -im() { tty -s; }
    2.10 -
    2.11 -
    2.12 -
    2.13 -
    2.14  unset desc
    2.15  
    2.16  # 1) Localized description
     3.1 --- a/modules/getenv	Sat Jan 07 09:06:14 2017 +0000
     3.2 +++ b/modules/getenv	Sun Jan 08 11:24:12 2017 +0200
     3.3 @@ -17,9 +17,6 @@
     3.4  
     3.5  . /lib/libtaz.sh
     3.6  
     3.7 -# Report error and finish work
     3.8 -die() { longline "$(_ "$@")" >&2; exit 1; }
     3.9 -
    3.10  # Show debug messages
    3.11  debug() {
    3.12  	if [ -n "$debug" ]; then
     4.1 --- a/modules/info	Sat Jan 07 09:06:14 2017 +0000
     4.2 +++ b/modules/info	Sun Jan 08 11:24:12 2017 +0200
     4.3 @@ -13,11 +13,6 @@
     4.4  
     4.5  
     4.6  
     4.7 -# Interactive mode
     4.8 -
     4.9 -im() { tty -s; }
    4.10 -
    4.11 -
    4.12  # Unset variables that may absent in the receipt
    4.13  unset EXTRAVERSION TAGS DEPENDS PROVIDE SIZES
    4.14  
     5.1 --- a/modules/list	Sat Jan 07 09:06:14 2017 +0000
     5.2 +++ b/modules/list	Sun Jan 08 11:24:12 2017 +0200
     5.3 @@ -30,11 +30,6 @@
     5.4  
     5.5  
     5.6  
     5.7 -# Interactive mode
     5.8 -
     5.9 -im() { tty -s; }
    5.10 -
    5.11 -
    5.12  # Functions set for translate categories
    5.13  # --------------------------------------
    5.14  
     6.1 --- a/modules/remove	Sat Jan 07 09:06:14 2017 +0000
     6.2 +++ b/modules/remove	Sun Jan 08 11:24:12 2017 +0200
     6.3 @@ -21,11 +21,6 @@
     6.4  }
     6.5  
     6.6  
     6.7 -# Interactive mode
     6.8 -
     6.9 -im() { tty -s; }
    6.10 -
    6.11 -
    6.12  # Block of receipt function callers
    6.13  # Why? "Bad" receipt sourcing can redefine some vital TazPkg variables.
    6.14  # Few receipts function should be patched now.
    6.15 @@ -209,6 +204,9 @@
    6.16  
    6.17  # [3/5] Post-remove commands
    6.18  call_post_remove "$INSTALLED/$PACKAGE/receipt"
    6.19 +# restore Busybox applets
    6.20 +. @@MODULES@@/bb restore
    6.21 +
    6.22  
    6.23  # [4/5] Update system databases
    6.24  fl="$INSTALLED/$PACKAGE/files.list"; upd=0