wok-6.x annotate busybox/stuff/command_not_found @ rev 23946
syslinux/taziso: add plop support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Sun Sep 20 14:15:26 2020 +0000 (2020-09-20) |
parents | def8459358ed |
children |
rev | line source |
---|---|
pascal@21860 | 1 #!/bin/sh |
pascal@21860 | 2 |
pascal@21869 | 3 FILES=/var/lib/tazpkg/files.list.lzma |
pascal@21869 | 4 LIST=/tmp/command-list.gz |
pascal@21872 | 5 [ -s $FILES ] && [ ! $LIST -nt $FILES ] && unlzma <$FILES | \ |
pascal@21872 | 6 grep -E "(: ${PATH//:/|: })" | gzip -9 >$LIST && chmod 666 $LIST |
pascal@21860 | 7 |
pascal@21861 | 8 lookup() { |
pascal@23946 | 9 zcat $LIST 2> /dev/null | grep "/$2$1$" | if read pkg file; then |
pascal@21860 | 10 cat <<EOT |
pascal@21860 | 11 Command '$1' not found, but can be installed as root with: |
pascal@21860 | 12 |
pascal@21860 | 13 tazpkg -gi ${pkg%:} |
pascal@21861 | 14 ${2:+$2$1} |
pascal@21860 | 15 EOT |
pascal@21871 | 16 fi |
pascal@21860 | 17 } |
pascal@21860 | 18 |
pascal@21860 | 19 MSG="$(lookup "$1")" |
pascal@21860 | 20 [ "$MSG" ] || MSG="$(lookup "$1" get-)" |
pascal@21861 | 21 echo "${MSG:-${SHELL##*/}: $1: not found}" |