* bin/updates-available: add a --short option, which only displays the

number of updates available; show more info on --detail about upgrades

Note: this will need to be improved for non Debian distros!

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
This commit is contained in:
Dustin Kirkland 2009-05-06 20:39:28 -05:00
commit fd943656b4

View file

@ -17,13 +17,14 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
if [ "$1" = "--detail" ]; then if [ "$1" = "--detail" -o "$1" = "--short" ]; then
if [ -x "/usr/bin/apt-get" ]; then if [ -x "/usr/bin/apt-get" ]; then
out=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade | grep ^Inst | sed "s/^Inst //"` detail=`/usr/bin/apt-get -s -o Debug::NoLocking=true upgrade`
if [ -z "$out" ]; then if [ "$1" = "--detail" ]; then
printf "None" printf "$detail"
else else
printf "$out" short=`printf "$detail" | grep ^Inst | wc -l`
printf "$short"
fi fi
fi fi
exit 0 exit 0