This file is indexed.

/usr/bin/check-enhancements is in debian-goodies 0.69.1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
#!/bin/bash

# Copyright (C) 2012 George Danchev <danchev@spnet.net>

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.

SELF=$(basename "$0")
VER=0.3

OPT_CHECK_INSTALLED_PACKAGES=0
OPT_SHOW_INSTALLED_ENHANCEMENTS=0
OPT_VERBOSE=0

print_version() {
echo "$VER"
}

print_help() {
cat << HLP
${SELF} ( -ip | -ie | -h | --verbose | --version )

Options:

 Program options start with dash or double dash, otherwise they
 are interpreted as package names. Only non-installed enhancement
 packages are printed out by default, use -ie to show them all.

 -ip, --ip, -installed-packages, --installed-packages
     Show enhancements of all installed packages (could be slow)
 -ie, --ie, -installed-enhancements, --installed-enhancements
     Show installed enhancement packages too
 -h, -help, --help
 -version, --version
 -verbose, --verbose

Examples:

# check enhancement packages of all installed packages
 ${SELF} -ip
# check enhancement packages of selected packages
 ${SELF} pkg1 pkgN

HLP
}

pkgs_enhancing_pkg_status() {
    # Figure out package Enhances:'ing a given package
    EN=`grep-dctrl -n -s Package -F Enhances -X "${1}" /var/lib/apt/lists/*Packages`
    case $? in
       0) if test $OPT_VERBOSE != 0; then echo -e "Package <<$1>> could be Enhanced by:"; fi
       ;;
       1) return
       ;;
       *) echo "${SELF}: Internal Error!"
          exit 1
       ;;
    esac
    for e in `echo "${EN}" | sort | uniq | xargs` # now sort and unify
    do
          # Figure out whether those enhancements are installed or not.
	  # By default only output non-installed enhancements
	  OUT=""
	  case "${OPT_SHOW_INSTALLED_ENHANCEMENTS}" in
	       0) OUT=`apt-cache policy ${e} | head -3 | paste -s | grep "Installed: (none)"`
	       ;;
	       1) OUT=`apt-cache policy ${e} | head -3 | paste -s`
	       ;;
	  esac
          if test x"$OUT" != x""; then printf "%2s => " "$1" && echo "${OUT}"; fi
    done
}

# main
declare -a PKGS=()
for op in $@
do
  case "${op}" in
    -ip|--ip|-installed-packages|--installed-packages)
      OPT_CHECK_INSTALLED_PACKAGES=1
    ;;

    -ie|--ie|-installed-enhancements|--installed-enhancements)
      OPT_SHOW_INSTALLED_ENHANCEMENTS=1
    ;;

    -h|-help|--help)
      print_help
      exit 0
    ;;

    -version|--version)
      print_version
      exit 0
    ;;

    -verbose|--verbose)
      OPT_VERBOSE=1
    ;;

    -*)
      echo "invalid option ${op}"
      print_help
      exit 1
    ;;

    *)
#      PKGS[$[${#PKGS[@]}+1]]="${op}"
      PKGS+=(${op})
    ;;
  esac
done

# no options, just show help
if test x"$1" == x""; then print_help; exit 0; fi

# process package names given on the cmdline
for cmdline_pkg in "${PKGS[@]}"
do
    pkgs_enhancing_pkg_status $cmdline_pkg
done

# process installed packages, as well
case $OPT_CHECK_INSTALLED_PACKAGES in
    1)
    for installed in $(grep-status -FStatus "install ok installed" -n -s Package | sort | uniq)
    do
       pkgs_enhancing_pkg_status $installed
    done
    ;;
esac

exit 0