[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: rollback after software upgrade

On Wed, 21 Jul 2010 20:07:37 +0300
Vladimir <tetlika@gmail.com> wrote:
> Is there a way to rollback the software after standard "apt-get
> (aptitude) upgrade"?

I use a little script which creates backup of the packages involved before doing the upgrade. I anything goes wrong during install all i have to do is to change into the backup directory and do dpgk -i *.




# /root/bin/getafix
# Script to save packages to be upgraded in /root/lib/upgrade/$DATE 
# using dpkg-repack
# In case something goes wrong, whilst upgrading, a simple dpkg -i /root/lib/upgrade/$DATE/*
# will (hopefully) rebuild a working system.

#set -x

apt-get update

# d-ated dir-ectory
DDIR="/root/lib/upgrades/"`date +%Y-%m-%d_%H:%M:%S`

echo $DDIR

# p-ackages t-o b-e u-pgraded
PTBU=`apt-get -s upgrade | grep "^Inst " | awk '{print $2}' ` ;  echo $PTBU

echo PTBU="->"$PTBU"<-"

if [[ -n $PTBU ]]; then  # PTBU non-zero
    mkdir $DDIR
    cd $DDIR
    dpkg-repack $PTBU
    echo "No upgrades"

Michael Dominok
Grenzstr.24 47226 Duisburg
+491773092680 michael@dominok.net

Reply to: