tazpkg view modules/bb @ rev 955

modules/search: allow search file with dash at start: tazpkg -sf "-spi"
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Dec 22 00:02:54 2017 +0200 (2017-12-22)
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