tazpkg view modules/bb @ rev 972

Remove ashism ==
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Feb 26 08:21:22 2019 +0100 (2019-02-26)
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