wok rev 21860

busybox: add command_not_found
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Sep 23 15:30:05 2019 +0200 (2019-09-23)
parents d310b6c488c0
children cf17791e53df
files busybox/receipt busybox/stuff/command_not_found hfsprescue/receipt
line diff
     1.1 --- a/busybox/receipt	Thu Sep 19 16:26:43 2019 +0100
     1.2 +++ b/busybox/receipt	Mon Sep 23 15:30:05 2019 +0200
     1.3 @@ -167,6 +167,7 @@
     1.4  	rm -f $fs/bin/bbconfig $fs/usr/bin/ar
     1.5  	mkdir -p $fs/etc/init.d $fs/var/spool/cron/crontabs $fs/var/spool/lpd \
     1.6  		 $fs/var/lib/misc
     1.7 +	cp $stuff/command_not_found $fs/bin
     1.8  
     1.9  	# Busybox config files.
    1.10  	for f in busybox.conf dnsd.conf udhcpd.conf inetd.conf httpd.conf \
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/busybox/stuff/command_not_found	Mon Sep 23 15:30:05 2019 +0200
     2.3 @@ -0,0 +1,26 @@
     2.4 +#!/bin/sh
     2.5 +
     2.6 +ZLIST=/var/lib/tazpkg/files.list.lzma
     2.7 +LIST=/tmp/command-list
     2.8 +
     2.9 +lookup()
    2.10 +{
    2.11 +	grep -s "/$2$1$" $LIST | while read pkg file; do
    2.12 +		cat <<EOT
    2.13 +Command '$1' not found, but can be installed as root with:
    2.14 +
    2.15 +tazpkg -gi ${pkg%:}
    2.16 +${2+$2$1}
    2.17 +
    2.18 +EOT
    2.19 +		break
    2.20 +	done
    2.21 +}
    2.22 +
    2.23 +if [ ! -s $LIST ] || [ $ZLIST -nt $LIST ]; then
    2.24 +	unlzma < $ZLIST | grep -E '(/usr/games/|bin/)' > $LIST
    2.25 +fi
    2.26 +MSG="$(lookup "$1")"
    2.27 +[ "$MSG" ] || MSG="$(lookup "$1" get-)"
    2.28 +[ "$MSG" ] || MSG="${SHELL##*/}: $1: not found"
    2.29 +echo "$MSG"
     3.1 --- a/hfsprescue/receipt	Thu Sep 19 16:26:43 2019 +0100
     3.2 +++ b/hfsprescue/receipt	Mon Sep 23 15:30:05 2019 +0200
     3.3 @@ -1,7 +1,7 @@
     3.4  # SliTaz package receipt.
     3.5  
     3.6  PACKAGE="hfsprescue"
     3.7 -VERSION="1.1"
     3.8 +VERSION="3.4"
     3.9  CATEGORY="base-system"
    3.10  SHORT_DESC="HFS+ recovery tool."
    3.11  MAINTAINER="pascal.bellard@slitaz.org"