tazpkg view modules/bb @ 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
children
line source
1 #!/bin/sh
2 # TazPkg - Tiny autonomous zone packages manager, hg.slitaz.org/tazpkg
3 # bb - TazPkg module
4 # Manage Busybox applets
7 # Input: $1 - command:
8 # restore restore missing Busybox applets
9 # replaced list of the replaced Busybox applets
10 #
11 # Variable $root points to the root of the installation
14 # Connect function libraries
15 . /lib/libtaz.sh
20 [ ! -x "$root/bin/busybox" ] && die 'Busybox is not installed in the %s. Exit.' "$root"
22 # Full list but skipping some applets: bbconfig, linuxrc
23 applets_list=$($root/bin/busybox --list-full | grep -v 'bbconfig\|linuxrc')
25 case $1 in
26 restore)
27 mkdir -p "$root/sbin" "$root/usr/bin" "$root/usr/sbin"
28 for applet in $applets_list; do
29 if [ ! -x "$root/$applet" ]; then
30 action 'Restoring Busybox applet %s...' "$(basename $applet)"
31 case $(dirname $applet) in
32 bin) ln -sf 'busybox' "$root/$applet";;
33 sbin) ln -sf '../bin/busybox' "$root/$applet";;
34 usr/*bin) ln -sf '../../bin/busybox' "$root/$applet";;
35 esac
36 status
37 fi
38 done
39 ;;
40 replaced)
41 ls -l $(echo "$applets_list" | sed "s|^|$root/|") 2>/dev/null | \
42 awk -vr="$root" '{if ($0 !~ /busybox$/){sub(r, ""); print $9}}'
43 ;;
44 esac