File:  [Research Unix] / researchv10no / cmd / dist / talk / slide7
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:21:35 2018 UTC (8 years, 1 month ago) by root
Branches: belllabs, MAIN
CVS tags: researchv10, HEAD
researchv10 Norman

.ce
How \fIinsdist\fP works
.sp 2
.BU
We want either completely install the distribution, or
completely fail to install it; we don't want the file system
left in an intermediate state.
Initial idea:
.CO
tar cf $backup $files
tar t $backup | sort > $oldlist
tar tf $tarfile | sort > $newlist
if tar xf $tarfile
then
	comm -23 $oldlist $newlist > $remove
	test -s $remove && xargs rm -fr < $remove
else
	tar xf $backup
	comm -13 $oldlist $newlist > $remove
	test -s $remove && xargs rm -fr < $remove
fi
.CE
.BU
Unfortunately, line oriented text utilities don't like
funny file names.  We can fix this with \f(CWqargs\fP and
\f(CWuargs\fP.
Revised code:
.CO
# assume $files is in qargs format
uargs tar cf $backup $files
# tarf -tq prints tarfile contents in qargs format
tarf -tq < $backup | sort > $oldlist
tarf -tq < $tarfile | sort > $newlist
if tar xf $tarfile
then
	comm -23 $oldlist $newlist > $remove
	test -s $remove && xargs uargs rm -fr < $remove
else
	tar xf $backup
	comm -13 $oldlist $newlist > $remove
	test -s $remove && xargs uargs rm -fr < $remove
fi
.CE

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.