[ Thread Index |
Date Index
| More lists.tuxfamily.org/slitaz Archives
]
- To: slitaz <slitaz@xxxxxxxxxxxxxxxxxxx>
- Subject: tazpkg logging
- From: "Mike D. Smith" <mikedsmith25@xxxxxxxxx>
- Date: Sun, 26 Oct 2008 00:42:05 -0700
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=13drjoeUzc7qb9B4sHD63G/8FeA2O2laBGImlavf8PU=; b=TufCvSfT/U/1Ikdwfh7SIzMuUiwbO77mEYJxTSmDIEKMf0PvYIFhh9onkIciQvwFxV zjtXbkFtiRNE9FwT3LHOaxtmYhTkqv8Hfl1EDK+j7ijEiHFTKMZqgAC5AXUJ/r0Kykat CI6ahasWWpAJM4j0zNeY3xyrxWuVIGbDVqMcA=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=nUy7VPsDh5oqdujJfuMjzpZmKA57y13CnjoGIoZlPLIMvEi37w7bF8mamVpssStbb9 DYyPw4N7lcGoEUiOQJ2Z8qzVQneKcsKeiCk12Tj19DM5cJuQxvT/JocAAC2GN7voefl3 eDvMeJsof1E2wjsGOhcB2PQTass8L00HoV+M8=
Hi Guys,
I've been using the following patch for tazpkg to keep track of when packages are installed or removed on my system so that I can go back and see what happened if I ever need to track something down.
I'm just wondering what people think of this type of logging in general and if anyone else finds it useful.
The patch creates a log at /var/log/tazpkg.log. Here is an example on a fresh Slitaz 2.0 Cooking install after a few packages are added and removed (and added again):
2008-10-25 22:49:04 - Installed - binutils (2.17.50)
2008-10-25 22:49:07 - Installed - linux-headers (2.6.25.5)
2008-10-25 22:49:36 - Installed - bash (3.2)
2008-10-25 22:49:37 - Installed - glibc-dev (2.7)
2008-10-25 22:50:39 - Installed - gcc (4.2.3)
2008-10-25 22:50:40 - Installed - make (3.81)
2008-10-25 22:50:40 - Installed - slitaz-toolchain (1.0)
2008-10-25 22:53:56 - Installed - python (2.5.1)
2008-10-25 22:53:58 - Installed - patch (2.5.4)
2008-10-25 22:54:04 - Installed - libcrypto (0.9.8g)
2008-10-25 22:54:04 - Installed - openssl (0.9.8g)
2008-10-25 22:54:04 - Installed - mercurial (1.0)
2008-10-25 23:07:02 - Installed - vim (7.2)
2008-10-25 23:07:11 - Installed - tree (1.5.2.1)
2008-10-26 00:14:38 - Removed - vim (7.2)
2008-10-26 00:15:17 - Removed - tree (1.5.2.1)
2008-10-26 00:15:52 - Installed - vim (7.2)
The patch is below if anyone is interested.
-Mike
---
# HG changeset patch
# User Mike D. Smith <MikeDSmith25@xxxxxxxxx>
# Date 1216576258 0
# Node ID 60dbc0b56a9c36c95841c7cd6f167934be601e64
# Parent d5a396f4394268b4e96bbc0a5f076bb23a6b8758
tazpkg: Add logging support
diff -r d5a396f43942 -r 60dbc0b56a9c tazpkg
--- a/tazpkg Sun Jul 20 07:42:20 2008 +0000
+++ b/tazpkg Sun Jul 20 17:50:58 2008 +0000
@@ -59,6 +59,7 @@
BLOCKED=$LOCALSTATE/blocked-packages.list
DEFAULT_MIRROR="http://mirror.slitaz.org/packages/`cat /etc/slitaz-release`/"
INSTALL_LIST=""
+LOG=/var/log/tazpkg.log
# Bold red warning for upgrade.
WARNING="\\033[1;31mWARNING\\033[0;39m"
@@ -341,6 +342,9 @@
echo "================================================================================"
echo "$PACKAGE ($VERSION$EXTRAVERSION) is installed."
echo ""
+ # Log this activity
+ DATE=`date +'%F %T'`
+ echo "$DATE - Installed - $PACKAGE ($VERSION$EXTRAVERSION)" >> $LOG
}
# Check for loop in deps tree.
@@ -1069,6 +1073,9 @@
echo -n "Removing package receipt..."
rm -rf $INSTALLED/$PACKAGE
status
+ # Log this activity
+ DATE=`date +'%F %T'`
+ echo "$DATE - Removed - $PACKAGE ($VERSION$EXTRAVERSION)" >> $LOG
if [ -n "$ALTERED" ]; then
echo -n "Remove packages depending on $PACKAGE"
echo -n " (y/N) ? "; read anser