#!/bin/sh -e # sorted list of installed RPM packages - Peter Csizmadia, 2006.05.18-2008.11.09 if [ "$1" = "" ]; then cat < | tac - reverse order EOF exit 0 fi if [ "$1" = "i" ]; then LANG=en_US rpm -qa --qf "%010{INSTALLTIME} %{INSTALLTIME:date} %8{SIZE} %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n"\ | sort \ | awk '{printf("%s %s %s %s %s %s %s %5.1fM %s\n", $2, $3, $4, $5, $6, $7, $8, $9/1048576.0, $10)}' elif [ "$1" = "n" ]; then LANG=en_US rpm -qa --qf "%{NAME}-%{VERSION}-%{RELEASE}%{ARCH} %{INSTALLTIME:date} %8{SIZE}\n"\ | sort \ | awk '{printf("%s %s %s %s %s %s %s %5.1fM %s\n", $2, $3, $4, $5, $6, $7, $8, $9/1048576.0, $1)}' else LANG=en_US rpm -qa --qf "%010{SIZE} %{INSTALLTIME:date} %{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n"\ | sort \ | awk '{ if ($1 >= 10240000000) { printf("%3.0fG ", $1/1073741824.0); } else if ($1 >= 1024000000) { printf("%3.1fG ", $1/1073741824.0); } else if ($1 >= 10240000) { printf("%3.0fM ", $1/1048576.0); } else if ($1 >= 1024000) { printf("%3.1fM ", $1/1048576.0); } else if($1>=10000) { printf("%3.0fk ", $1/1024.0); } else if($1>=1000) { printf("%3.1fk ", $1/1024.0); } else { printf("%4d ", $1); } printf("%s %s %s %s %s %s %s %s\n", $2, $3, $4, $5, $6, $7, $8, $9)}' fi