Total Pageviews

Friday, 28 December 2012

在UBUNTU下,追踪软件的安装情况



I tried deborphan and debfoster, but that is not really what I want. Here is a simple script to keep track of the apt-get install.

#!/bin/bash
# aptinstall.sh

# Run this script like
# aptinstall.sh nano

# change this line to your own directory
DIR=/home/tmtong/conf

apt-get --force-yes -y install $@ 2>&1 | tee $DIR/install.tmp
echo "" >> $DIR/install.tmp
echo "=====================================================" >> $DIR/install.tmp
echo "" >> $DIR/install.tmp
echo ""
echo -n "Logging Installation Down ... "
[ ! -f $DIR/install.log ] && touch $DIR/install.log
cat $DIR/install.log >> $DIR/install.tmp
mv $DIR/install.tmp $DIR/install.log
echo "Done"