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

Re: Package Snapshot Restore Tool



On Fri, Aug 06, 2004 at 01:06:45AM +0200, Michael Rumpf wrote:
> Hi,
> 
> I'm currently working on a backup concept for my Debian server.
> I'm searching for a tool that makes a snapshot of the currently
> installed packages and in the case of a failure, when I need to restore
> the machine, retrieves all previously installed packages.
> 
> An ideal solution would be integrated (plugin) into mondorescue which
> I'm going to use for my backups.

I have implemented such a system with just some bash scripts and grep, 
sed, dpkg-scanpackages, &c.  I keep archives of all the .debs on my 
machine in case I need to rollback, but snapshot.debian.net also 
provides this.

I've posted these script a bunch of times.

Most of my scripts and programs I write are ultra-hackish and only 
really work for me, but, who cares, I have a snapshot/rollback system 
that gets the job done for me.  That's what Debian's all about.

[/a/x]
if [[ "$dt" == "" ]]; then dt=`date +"%y%m%d_%H%M%S"`; else dt=$1; fi
sub=dists/latest/binary-i386
cd /a
cd l; if [[ `ls *%* 2>/dev/null | wc -l` -ne 0 ]]; then for x in *%*; do mv $x ${x/_[0-9]*\%3a/_}; done; fi; cd ..
echo Scanning Packages...
dpkg-scanpackages l /dev/null > $sub/Packages
##dpkg-scanpackages l /dev/null 2>&1 > $sub/Packages | grep -v "tar: Removing leading"
grep -Ex "Filename: l/.+" $sub/Packages | sed "s/Filename: l\/\(.*\)/\1/" > o/L$dt
pushd $sub
rm Packages.gz
gzip Packages
popd
mv l $dt
mkdir l
for x in `cat o/L$dt`; do mv $dt/$x l; done
gzip o/L$dt
if [[ `ls $dt | wc -l` -eq 0 ]]; then rm -r $dt;
  else echo $dt `ls $dt | wc -l`; mv $dt o; fi

-------- [/a/u]
dt=`date +"%y%m%d_%H%M%S"`
mv /var/cache/apt/archives/*.deb /a/l
apt-get clean
/a/x $dt
apt-get update
/a/a | gzip > /a/o/A$dt.gz

-------- [/a/a]
apt-cache -f pkgnames | xargs apt-cache show | \
grep-dctrl -sPackage,Version . | grep '.' | sed -e \
"s/Package: /*/" -e "s/Version: /|/" | tr '\n' '|' | sed -e "s/*//g" \
 -e "s/||/ /g" | tr '|' '\n' | sort



Reply to: