Subject: sup server questions...
To: None <>
From: Luke Mewburn <>
List: current-users
Date: 05/24/1994 16:53:09
I've got some (probably very stupid) questions regarding sup & sup

Currently I'm supping from sun-lamp every day or so onto a local
net.connected machine (`jacana'.) After a successful sup, I
run a script I wrote (attached at the bottom of this message)
to generate a shar file (with the appropriate rm/rmdirs/etc)
to get my tree on my other machine (`karybdis') in sync. This is
because karybdis hasn't been net.connected until now.

So, here's the sequence of events:
    (login from karybdis)
	jacana%  sup -v SUPFILE |& tee log/940524
	jacana%  sup2shar log/940524 > 940524.diff
	jacana%  gzip -9 940524.diff
	jacana%  sz -b 940524.diff.gz
    (escape back to karybdis)
	karybdis% cd /usr/src/..	# above src/othersrc/doc
	karybdis% gzcat 940524.diff.gz | sh

Now, what I want to do is run a sup _server_ on jacana on the tree I
sup from sun-lamp. This server will serve karybdis directly, and
probably some other people (like my friends @telecom/@werj :)

What I want to know is:
    - I'm pretty sure that you can serve from a tree you sup from
      elsewhere. Can someone give me the some basic instructions on
      how to do this.

    - the /usr/src on karybdis is my active one, with .o files, etc.
      how does sup handle situtations where a directory is removed on
      the server, but my directory has some .o & .0 files lying in
      there still. Hopefully, quite easily :)

(Here's my script which takes a sup -v logfile and creates a shar file
from it; great for updating a machine over a mail only or floppy only
(you know, take floppy home from work :) link)

--- cut here --- file: sup2shar
# sup2shar -
#	Parses the output of a sup -v logfile and generates a shell script
#	to run on another host containing the commands to get its source
#	tree in sync.
# This program is placed in the public domain, and may be freely used
# with the restriction that this header remains intact, and you do not
# try to claim you wrote this.
# Author:	Luke Mewburn <>
# Date:		940510
# Version:	1.2
# 940226, lm	- original program
# 940227, lm	- added killdir functionalitiy (to clean up objdir symlinks)
#		- added file mod time restoration (touch)
# 940311, lm	- removed touch
# 940510, lm	- added -u.

require "";

$progname = $0; 
$progname =~ s@.*/@@;

sub usage
    print <<USAGE;
Usage: $progname [-u] file
parses the output of a 'sup -v logfile' and generates a shar file
containing the commands to get its source tree in sync.
	-u	`Updating' lines are considered `Receiving' lines.
		(when the log file is of a 2nd attempt and you
		already had 1/2 the files.)
    exit 1;

&Getopts('u') || &usage();

select(STDERR); $| = 1;
select(STDOUT); $| = 1;

chop($date = `date`);
chop($user = `whoami`);
chop($hostname = `hostname`);

print <<HEADER;
# Made $date by $user@$hostname


print <<'SHFUNCS';
    if [ -e $1/obj ]; then
	rm -rf `cd $1/obj;pwd`
    rm -rf $1


while (<>)
    next MAIN unless /^SUP /;
    if (   /^SUP Backup of/
	|| /^SUP Executing/
	|| /^SUP Created (\S*)link/
	|| /^SUP Deleted symbolic link/
	|| /^SUP Removed/ )
	print STDERR "Unsupported directive: $_\n";
	next MAIN;

    /^SUP Deleted directory (\S*)$/o && do
	    print "echo remove dir $1\n";
	    print "killdir $1\n";
	    print STDERR "killdir $1\n";
	    last SW;
    /^SUP Deleted file (\S*)$/o && do
	    print "echo rm $1\n";
	    print "rm $1\n";
	    print STDERR "rm $1\n";
	    last SW;
    /^SUP Created directory (\S*) for (\S*)$/o && do
	    print "echo mkdir $1\n";
	    print "mkdir $1\n";
	    print STDERR "mkdir $1\n";
	    last SW;
    /^SUP (Receiving|Updating) file (\S*)$/o && do
	    local($func, $file)=($1, $2);
	    next if (($func eq "Updating") && (! $opt_u));
	    next unless (-e $file);
	    print "echo x - $file\n";
	    print "sed 's/^X//' >$file <<'SHAR_EOF'\n";
	    system("sed 's/^/X/' $file");
	    print "SHAR_EOF\n";
	    print STDERR "-- $file\n";
	    last SW;
    } # endSW

# Messages that we may need to handle from sup -v
# Used:
#	SUP Deleted directory %s
#	SUP Deleted file %s
#	SUP Receiving file %s
#	SUP Created directory %s for %s
# Unused (ignored during parsing):
#	SUP Backup of %s created
#	SUP Updating file %s
#	SUP Executing %s
#	SUP Created directory %s\n"
#	SUP Updated directory %s\n"
#	SUP Created symbolic link %s to %s
#	SUP Created %slink %s to %s
#	SUP Deleted symbolic link %s
#	SUP Removed %s %s
--- cut here ---