[ale] list pkgs installed since os install?

Tim Watts timtw at earthlink.net
Thu Aug 6 09:59:27 EDT 2009


Thanks for the all the suggestions folks. Next time I'll take a closer look at 
APTonCD.

But for now the (inelegant) script below worked nicely in my case. I ended up 
grepping the logs because my fs doesn't keep date-created on files (that might 
not have worked correctly anyway). The "tricky" part was selecting the 
*initial* install dates and discarding the updates. (Actually the tricky part 
was *realizing* that I only wanted the initial install date).

---------------------------------------------------------------------
#!/bin/bash

LOGS="/var/log"
WORKFILE=`mktemp`
DT_OS_INS="2009-03-02"

# TODO warn if logs don't reach back to os install.
# TODO calc os install date.

# List dates of all installed packages
# - CAVEAT: assumes logs have complete history
# - pkgs may have been uninstalled but we don't care at this point
(cat $LOGS/dpkg.log $LOGS/dpkg.log.1; \
  gunzip --stdout $LOGS/dpkg.log.*.gz) \
  | grep -P "status installed " \
  | sort >$WORKFILE

# foreach pkg *still* installed find its initial install date
# and spit out any on/after os ins date. Don't want to know
# about updated pkgs.
function find_init_install() {
  for f in `aptitude -F %p search '!~M~i'`; do
    entry=`grep -m 1 "installed $f " <$WORKFILE`
    if [ $? -eq 0 ]; then
      dt=${entry:0:10}
      if [[ "$dt" < "$DT_OS_INS" ]]; then
	: ;
      else
	echo "$entry" | cut -d " " -f 1,2,5,6
      fi
    fi
  done
}

find_init_install # | sort

rm $WORKFILE
---------------------------------------------------------------------

On Thursday 06 August 2009 5:47:41 am Paul Cartwright wrote:
> On Wed August 5 2009, Tim Watts wrote:
> > Anyone know of a way to list all packages installed on a system (Kubuntu
> > 8.10) since the OS was installed? It doesn't seem possible to do this
> > based on the info apt keeps. Have I missed something?
>
> http://aptoncd.sourceforge.net/
> What is APTonCD?
>
> APTonCD is a tool with a graphical interface which allows you to create one
> or more CDs or DVDs (you choose the type of media) with all of the packages
> you've downloaded via APT-GET or APTITUDE, creating a removable repository
> that you can use on other computers.
> APTonCD will also allow you to automatically create media with all of
> your .deb packages located in one especific repository, so that you can
> install them into your computers without the need for an internet
> conection.

-- 
Before you embark on a journey of revenge, dig two graves.
 -- Confucius

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20090806/1243a6c7/attachment.html 


More information about the Ale mailing list