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