source: trunk/debathena/debathena/command-not-found/debian/10-command-not-found @ 24000

Revision 24000, 1.2 KB checked in by geofft, 15 years ago (diff)
Add the debathena-command-not-found package. Patch from Jessica Hamrick <jhamrick@mit.edu>.
Line 
1# This is the Debathena handle for command-not-found.  It uses
2# the functionality of both command-not-found and whichlocker.
3
4function command_not_found_handle {
5         INLOCKER=""
6         if [ -x /usr/lib/whichlocker ]; then
7            INLOCKER=`/usr/lib/whichlocker "$1"`
8            if [ ! -z "$INLOCKER" ]; then
9               echo "Found in the following Athena lockers: "
10               echo "$INLOCKER"
11               echo "Run \`add <lockername>; $1\` (without the quotes)"
12            fi
13         fi
14
15         CANSUDO=""
16         if [ "$UID" == 0 ]; then
17            CANSUDO="true"
18         else
19            ISADMIN=`groups | grep -o "\badmin\b"`
20            if [ ! -z "$ISADMIN" ]; then
21                   CANSUDO="true"
22            fi
23         fi
24
25         if [ ! -z "$CANSUDO" ]; then
26            if [ -x /usr/lib/command-not-found ]; then
27               INAPT=$(/usr/bin/python /usr/lib/command-not-found -- "$1" 2>&1)
28               if [ ! -z "$INLOCKER" ]; then
29                  if [ ! -z "$INAPT" ]; then
30                     echo ""
31                     echo "In apt:"
32                  fi
33               fi
34               echo "$INAPT"
35            fi
36         fi
37
38         return 127
39}
Note: See TracBrowser for help on using the repository browser.