summaryrefslogtreecommitdiff
path: root/packaging/utils
diff options
context:
space:
mode:
authorRene Mayrhofer <rene@mayrhofer.eu.org>2006-05-22 05:12:18 +0000
committerRene Mayrhofer <rene@mayrhofer.eu.org>2006-05-22 05:12:18 +0000
commitaa0f5b38aec14428b4b80e06f90ff781f8bca5f1 (patch)
tree95f3d0c8cb0d59d88900dbbd72110d7ab6e15b2a /packaging/utils
parent7c383bc22113b23718be89fe18eeb251942d7356 (diff)
downloadvyos-strongswan-aa0f5b38aec14428b4b80e06f90ff781f8bca5f1.tar.gz
vyos-strongswan-aa0f5b38aec14428b4b80e06f90ff781f8bca5f1.zip
Import initial strongswan 2.7.0 version into SVN.
Diffstat (limited to 'packaging/utils')
-rwxr-xr-xpackaging/utils/backup80
-rwxr-xr-xpackaging/utils/branch70
-rwxr-xr-xpackaging/utils/canrel55
-rw-r--r--packaging/utils/disttools.pl357
-rwxr-xr-xpackaging/utils/errcheck40
-rw-r--r--packaging/utils/kernel.patch.gen.sh52
-rwxr-xr-xpackaging/utils/kerneldiff35
-rwxr-xr-xpackaging/utils/kernelpatch55
-rwxr-xr-xpackaging/utils/kernelversion10
-rwxr-xr-xpackaging/utils/kernelversion-short8
-rwxr-xr-xpackaging/utils/manlink74
-rwxr-xr-xpackaging/utils/maysnap41
-rwxr-xr-xpackaging/utils/maytest42
-rwxr-xr-xpackaging/utils/mkcand126
-rwxr-xr-xpackaging/utils/mkrel95
-rwxr-xr-xpackaging/utils/mksnap114
-rwxr-xr-xpackaging/utils/mvcand62
-rwxr-xr-xpackaging/utils/mvrel65
-rwxr-xr-xpackaging/utils/patcher188
-rwxr-xr-xpackaging/utils/prepcand33
-rwxr-xr-xpackaging/utils/recan17
-rwxr-xr-xpackaging/utils/setup9
-rwxr-xr-xpackaging/utils/sshenv4
-rwxr-xr-xpackaging/utils/tattle33
-rwxr-xr-xpackaging/utils/wantsnap3
-rwxr-xr-xpackaging/utils/wanttest10
26 files changed, 1678 insertions, 0 deletions
diff --git a/packaging/utils/backup b/packaging/utils/backup
new file mode 100755
index 000000000..0c860c280
--- /dev/null
+++ b/packaging/utils/backup
@@ -0,0 +1,80 @@
+#! /bin/sh
+# make backup of FreeSwan repository
+# -l local build only, do not transmit
+
+#scphost=freeswan@xs1.xs4all.nl
+scphost=henry@adams.freeswan.org
+scpdir=backup
+pfile=~freeswan/etc/relpass
+ppfile=~freeswan/etc/bpp
+
+PATH=/bin:/usr/bin
+export PATH
+umask 077
+
+tmpdir=~freeswan/tmp
+tarname=freeswan.tar
+
+. ~freeswan/setup
+
+cd $tmpdir
+rm -f $tarname $tarname.gz
+touch $tarname
+
+cd ~freeswan
+tar -cf $tmpdir/$tarname `ls -a |
+ egrep -v '^(\.|\.\.|archive|\.nobak|\.ssh|\.ssh2|tmp)$'`
+
+cd $tmpdir
+gzip -9 $tarname
+ls -l $tarname.gz
+
+if test " $1" = " -l"
+then
+ exit 0
+fi
+
+echo updating >notice
+
+date
+expect -nN -c "
+ set scphost $scphost
+ set scpdir $scpdir
+ set pfile $pfile
+ set ppfile $ppfile
+ set tarname $tarname
+ "'
+ # canned procedure for scp copying
+ proc scp {from to} {
+ global p scphost scpdir
+ spawn scp2 -p -q $from $scphost:$scpdir/$to
+ set timeout -1
+ expect {
+ "word:" {
+ set fname $pfile
+ # fall out
+ }
+ {":} {
+ set fname $ppfile
+ # fall out
+ }
+ eof {
+ puts "eofed!"
+ return
+ }}
+ sleep 3
+ set f [open $fname r]
+ set p [read $f]
+ close $f
+ send "$p\r"
+ expect "\n"
+ expect eof
+ wait
+ }
+
+ scp notice $tarname.gz
+ scp $tarname.gz $tarname.gz
+ # done'
+date
+
+rm -f $tarname.gz
diff --git a/packaging/utils/branch b/packaging/utils/branch
new file mode 100755
index 000000000..2c13d4b6a
--- /dev/null
+++ b/packaging/utils/branch
@@ -0,0 +1,70 @@
+#! /bin/sh
+# branch release
+
+PATH=/bin:/usr/bin ; export PATH
+umask 022
+
+. $HOME/freeswan-regress-env.sh
+
+case "$1" in
+*.*) ;;
+*) echo "Usage: $0 release [file...]" >&2 ; exit 2 ;;
+esac
+
+rel="$1"
+shift
+tr="`echo $rel | tr '.' '_'`"
+pre=PRE$tr
+base=BASE$pre
+
+echo "generating key for branch"
+SNAPPGP=$SNAPSHOTSIGDIR/$base
+# Note: PGPPATH is limited to 50 characters.
+PGPPATH=$SNAPPGP export PGPPATH
+mkdir -p $PGPPATH
+touch $PGPPATH/pgpdoc1.txt
+touch $PGPPATH/pgpdoc2.txt
+
+if [ ! -f $PGPPATH/secring.pgp ]
+then
+ echo "Please set userid to '<build+snap$tr@freeswan.org>'$PGPPATH"
+ pgp -kg
+
+ echo -n "Please insert release key floppy for signature"
+ read ans
+ mount /mnt/build
+ PGPPATH=/mnt/build/freeswan export PGPPATH
+
+ echo "Now signing key - please answer yes."
+ pgp $SNAPPGP/pubring.pgp
+
+ echo Please put key in $SNAPPGP/signedkey.asc
+ pgp -kxa build+snap$tr@freeswan.org
+
+ umount /mnt/build
+
+fi
+
+if [ ! -f snapshotsigs.pgp ]
+then
+ PGPPATH=$SNAPPGP export PGPPATH
+ echo "Now importing key"
+ pgp $SNAPPGP/signedkey.asc
+
+ cp $SNAPPGP/signedkey.asc snapshotsigs.pgp
+ cvs add snapshotsigs.pgp
+ cvs commit -m"Signing key for $rel" snapshotsigs.pgp
+fi
+
+echo -n "PGP finished, now budding, press enter"
+read ans
+
+echo "budding..."
+rm -f Makefile.ver
+cvs tag $opt -c $base $*
+echo
+echo "branching..."
+cvs tag $opt -b -r $base $pre $*
+
+
+
diff --git a/packaging/utils/canrel b/packaging/utils/canrel
new file mode 100755
index 000000000..567ce96a8
--- /dev/null
+++ b/packaging/utils/canrel
@@ -0,0 +1,55 @@
+#! /bin/sh
+# canrel [-F] release
+# -F means override previous run
+# current versions in the repository are used
+# must be run in a release-branch CVS working directory with current top/*
+
+PATH=/bin:/usr/bin ; export PATH
+umask 022
+
+. ~build/freeswan-regress-env.sh
+
+opt=
+case "$1" in
+-F) opt=-F ; shift ;;
+esac
+
+case "$#:$1" in
+1:*.*) ;;
+*) echo "Usage: $0 release" >&2 ; exit 2 ;;
+esac
+
+rel="$1"
+pretag="PRE`echo $rel | tr '.' '_'`"
+rtag="R`echo $rel | tr '.' '_'`"
+
+sed '1s/xxx/'"$rel"'/' README >README.$$
+if cmp -s README README.$$
+then
+ : already current, for some reason
+ rm -f README.$$
+else
+ mv README.$$ README
+ cvs -Q commit -m "update for release $rel" README
+fi
+sed '/=.*/s//='"$rel"'/' Makefile.ver >mversion.$$
+if cmp -s Makefile.ver mversion.$$
+then
+ : already current, for some reason
+ rm -f mversion.$$
+else
+ mv mversion.$$ Makefile.ver
+ cvs -Q commit -m "update for release $rel" Makefile.ver
+fi
+sed '1s/xxx/'"$rel"'/' CHANGES >CHANGES.$$
+if cmp -s CHANGES CHANGES.$$
+then
+ : already current, for some reason
+ rm -f CHANGES.$$
+else
+ mv CHANGES.$$ CHANGES
+ cvs -Q commit -m "update for release $rel" CHANGES
+fi
+cd ..
+
+cvs rtag $opt -r $pretag $rtag all
diff --git a/packaging/utils/disttools.pl b/packaging/utils/disttools.pl
new file mode 100644
index 000000000..4ea8db61d
--- /dev/null
+++ b/packaging/utils/disttools.pl
@@ -0,0 +1,357 @@
+#!/usr/bin/perl
+
+#
+# $Id: disttools.pl,v 1.1 2004/03/15 20:35:27 as Exp $
+#
+# $Log: disttools.pl,v $
+# Revision 1.1 2004/03/15 20:35:27 as
+# added files from freeswan-2.04-x509-1.5.3
+#
+# Revision 1.13 2003/06/17 22:30:06 build
+# adjusted userid to pick
+# use key that is offline.
+#
+# Revision 1.12 2002/09/30 16:02:17 mcr
+# added handling for date stamp.
+#
+# Revision 1.11 2002/08/30 01:30:25 mcr
+# changed code to write maintain local copy of FTP site,
+# and rsync things up when needed.
+#
+# Revision 1.10 2002/07/29 05:13:33 mcr
+# append .gz to patch files before they are signed.
+#
+# Revision 1.9 2002/07/29 04:02:21 mcr
+# removed errant ) from tar copy line.
+#
+# Revision 1.8 2002/07/29 03:57:59 mcr
+# produce kernel patches as part of the snapshots, candidates
+# and releases.
+#
+# Revision 1.7 2002/06/07 18:23:49 mcr
+# adjusted sendfiles to use tar to copy rather than scp.
+# mkcand now prints usage if you don't give it enough arguments.
+# It also now updates the "CANDIDATE" symlink.
+# mksnap properly quotes the wildcards in the -name for find.
+#
+# Revision 1.6 2002/06/03 03:10:58 mcr
+# "upload" now takes argument to indicate name to
+# install/upload for the symlink.
+#
+# Revision 1.5 2002/06/03 02:19:40 mcr
+# fixed bug in datelettername() - y/sed was not applied to $let,
+# but to $_.
+#
+# Revision 1.4 2002/06/03 02:14:16 mcr
+# die statements are now numbered for easier backtracking.
+# candidate checks are now done if $candidate arg=1: edit README
+# and CHANGES file for mkcand.
+#
+# Revision 1.3 2002/05/30 23:24:22 mcr
+# working "mksnap" and disttools.pl.
+#
+# Revision 1.2 2002/05/30 22:20:56 mcr
+# initial debugging done.
+#
+# Revision 1.1 2002/05/30 21:24:00 mcr
+# perl-ified mksnap.
+#
+#
+
+@supportedkernels=("2.0", "2.2", "2.4");
+
+sub nicesystem {
+ if($debug) {
+ print STDERR "System: ",join(' ',@_)."\n";
+ }
+ system(@_);
+ if($? == 0) {
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+sub kpatchname {
+ local($pkgname, $ver)=@_;
+ local($name);
+
+ $name = $pkgname.".k".$ver.".patch";
+ return $name;
+}
+
+
+sub datelettername {
+ @MoY = ('jan','feb','mar','apr','may','jun',
+ 'jul','aug','sep','oct','nov','dec');
+
+ $letters="abcdefghjklmnpqrstuvwxyz";
+
+ ($sec, $min, $hour, $mday, $mon, $year) = gmtime(time);
+
+ $let=substr($letters, $hour-1, 1);
+ if($min >= 30) {
+ $let =~ y/a-z/A-Z/;
+ }
+
+ if($year < 1900) {
+ $year += 1900;
+ }
+
+ $ver=sprintf("%04d%s%02d%s", $year, $MoY[$mon], $mday, $let);
+ $ver;
+}
+
+sub snapname {
+ local($prefix)=@_;
+ $snapname=$prefix.&datelettername;
+ $snapname;
+}
+
+sub suckvars {
+ $envvar=$ENV{'HOME'}."/freeswan-regress-env.sh";
+
+ if(-f $envvar) {
+
+ open(SHVARS, $envvar) || die "001: Can not open $envvar: $!\n";
+ while(<SHVARS>) {
+ chop;
+ next if (/^\#/);
+
+ if(/(\S+)\=(\S+)/) {
+ $var=$1;
+ $value=$2;
+
+ $ENV{$var}=$value;
+ }
+ }
+ close(SHVARS);
+ }
+}
+
+sub defvar {
+ local($var,$value)=@_;
+
+ if(!defined($ENV{$var})) {
+ $ENV{$var}=$value;
+ }
+}
+
+sub defvars {
+ &defvar('BTMP', '/btmp');
+ if($ENV{'DEBUGFREESWANDIST'}) {
+ $debug=$ENV{'DEBUGFREESWANDIST'};
+ }
+}
+
+sub setuppgp {
+ local($lastrel)=@_;
+
+ $lastrel =~ y/\./\_/;
+
+ $ENV{'PGPPATH'}=$ENV{'SNAPSHOTSIGDIR'}."/BASEPRE$lastrel";
+ $ENV{'PGPNAME'}="build+snap".$lastrel."\@freeswan.org";
+}
+
+sub dopgpsig {
+ local($pkgname)=@_;
+
+ local($tarfile);
+ $tarfile=$pkgname.".tar";
+
+ $userid=$ENV{'PGPNAME'};
+ &nicesystem("pgp -sba $tarfile.gz -u $userid -o $tarfile.gz.sig") || die "002: PGP failed: $?\n";
+ &nicesystem("chmod a+r $tarfile.gz.sig");
+
+ foreach $ver (@supportedkernels) {
+ $file=&kpatchname($pkgname,$ver).".gz";
+ &nicesystem("pgp -sba $file -u $userid -o $file.sig") || die "002: PGP failed: $?\n";
+ &nicesystem("chmod a+r $file.sig");
+ }
+}
+
+
+# this function now does two things:
+# 1) makes the tar file of old
+# 2) makes the kernel patch file of new.
+#
+
+sub makedisttarfile {
+ local($tmpdir, $pkgname, $vername, $dirname, $date, $relopt, $candidate)=@_;
+ local($file);
+
+ &nicesystem("mkdir -p $tmpdir") || die "003: Can not mkdir $tmpdir\n";
+ chdir($tmpdir) || die "004: makedisttarfile: Can not chdir to $tmpdir\n";
+
+ # nuke anything that was there before
+ &nicesystem("rm -rf $dirname");
+
+ if(defined($date) && $date ne '') {
+ $minusD="-D \"${date}\"";
+ }
+
+ print "cvs -Q export $minusD ${relopt} -d ${dirname} freeswan\n";
+
+ &nicesystem("cvs -Q export $minusD ${relopt} -d ${dirname} freeswan") || die "005: CVS failed!\n";
+
+ chdir($dirname) || die "006: Can not chdir to $dirname\n";
+
+ open(VERSIONFILE, ">Makefile.ver") || die "007: failed to open Makefile.ver\n";
+ print VERSIONFILE "IPSECVERSION=".$vername."\n";
+ close(VERSIONFILE);
+
+ if($candidate) {
+ open(README, "README") || die "008: Can not edit README: $!\n";
+ $nreadme="README.$$";
+ open(NREADME, ">$nreadme") || die "009: Can not write README: $!\n";
+ $lines=1;
+ while(<README>) {
+ if($lines == 1) {
+ s/xxx/$vername/;
+ }
+# if(/^---$/) {
+# print STDERR "README not ready, run prepcand first\n";
+# die;
+# }
+ $lines++;
+ print NREADME;
+ }
+ close(NREADME);
+ close(README);
+ unlink("README") || die "010: Can not remove README: $!\n";
+ rename("$nreadme", "README") || die "011: Can not rename $nreadme to README: $!\n";
+
+ # now edit CHANGES file
+ open(CHANGES, "CHANGES") || die "012: Can not edit README: $!\n";
+ $nchanges="CHANGES.$$";
+ open(NCHANGES,">$nchanges") || die "013: Can not write README: $!\n";
+ $lines=1;
+ while(<CHANGES>) {
+ if($lines == 1) {
+ if(/since last release/) {
+ die "CHANGES not ready, run prepcand first";
+ }
+ s/xxx/$vername/;
+ }
+ $lines++;
+ print NCHANGES;
+ }
+ close(NCHANGES);
+ close(CHANGES);
+ unlink("CHANGES") || die "014: Can not remove CHANGES: $!\n";
+ rename("$nchanges", "CHANGES") || die "015: Can not rename $nreadme to README: $!\n";
+ }
+
+ &nicesystem("make -f dtrmakefile -s snapready") || die "016: failed to make snapshot ready for distribution: $?\n";
+
+ chdir("..") || die "017: failed to go to parent dir: $!\n";
+
+ unlink("$pkgname.tar");
+ unlink("$pkgname.tar.gz");
+ unlink("$pkgname.tar.gz.md5");
+
+ &nicesystem("tar -cf $pkgname.tar $dirname") || die "018: Failed to tar file: $?\n";
+
+ # make the kernelpatch for each of 2.0, 2.2, and 2.4.
+ foreach $ver (@supportedkernels) {
+ $file=&kpatchname($pkgname,$ver);
+ &nicesystem("make -C $dirname kernelpatch$ver >$file");
+ &nicesystem("gzip -9 $file");
+ }
+
+ &nicesystem("rm -rf $dirname") || warn "failed to cleanup $dirname\n";
+
+ &nicesystem("gzip -9 $pkgname.tar") || die "019: gzip died: $?\n";
+
+ &nicesystem("ls -l $pkgname.tar.gz");
+
+ &nicesystem("md5sum $pkgname.tar.gz >$pkgname.tar.gz.md5");
+ &nicesystem("chmod a+r $pkgname.tar.gz");
+}
+
+sub sendfiles {
+ local(@thefiles)=@_;
+
+ local($file, $localroot);
+
+if($ENV{'DEV_DIR'}) { $localroot=$ENV{'DEV_DIR'}; } else { $localroot=$ENV{'LOCAL_ARCHIVE'}; }
+
+ foreach $file (@thefiles) {
+ $dir=$file;
+ if(!($dir =~ s,(.*)/([^/]*),\1,)) {
+ $dir=".";
+ } else {
+ $file=$2;
+ }
+
+ &nicesystem("tar -C $dir -c -f - $file | tar -C ${localroot} -x -f -");
+ }
+}
+
+
+sub remotecmd {
+ local($cmd)=@_;
+
+ $distuser=$ENV{'DISTUSER'};
+ $disthost=$ENV{'DISTHOST'};
+ $distdir =$ENV{'DISTDIR'};
+ $ssh =$ENV{'ssh'};
+
+ &nicesystem("$ssh -l $distuser $disthost '$cmd'");
+}
+
+
+sub upload {
+ local($pkgname, $symlinkname)=@_;
+
+ local($localroot);
+
+if($ENV{'DEV_DIR'}) { $localroot=$ENV{'DEV_DIR'}; } else { $localroot=$ENV{'LOCAL_ARCHIVE'}; }
+
+ &sendfiles("$pkgname.tar.gz",
+ "$pkgname.tar.gz.sig",
+ "$pkgname.tar.gz.md5");
+
+ foreach $ver (@supportedkernels) {
+ $file=&kpatchname($pkgname,$ver).".gz";
+ &sendfiles($file, "$file.sig");
+ }
+
+ if(defined($symlinkname)) {
+ &sendfiles($symlinkname.".tar.gz.md5");
+ &nicesystem("cd $localroot && ln -f -s $pkgname.tar.gz $symlinkname.tar.gz && ln -f -s $pkgname.tar.gz.sig $symlinkname.tar.gz.sig");
+
+ foreach $ver (@supportedkernels) {
+ $file=&kpatchname($pkgname,$ver);
+ $newname=&kpatchname($symlinkname,$ver);
+ &nicesystem("cd $localroot && ln -f -s $file.gz $newname.gz && ln -f -s $file.gz.sig $newname.gz.sig");
+ }
+
+ }
+}
+
+sub upsync {
+
+ local($localroot, $distuser, $disthost, $distdir, $spoolhost, $spooluser);
+ local($masterhost, $masteruser, $masterdir);
+
+ $localroot=$ENV{'LOCAL_ARCHIVE'};
+ $distuser=$ENV{'DISTUSER'};
+ $disthost=$ENV{'DISTHOST'};
+ $distdir =$ENV{'DISTDIR'};
+ $ssh =$ENV{'ssh'};
+ $masterhost = $ENV{'MASTERHOST'};
+ $masteruser = $ENV{'MASTERUSER'};
+ $masterdir = $ENV{'MASTERDIR'};
+
+ # sync stuff to distribution site.
+ &nicesystem("rsync -e $ssh -r --delete -a -v -c $localroot/ $masteruser\@$masterhost:$masterdir/");
+
+ # sync stuff to xs4all site.
+ &nicesystem(print "rsync -e $ssh -r --delete -a -v -c $localroot/ $distuser\@$disthost:$distdir/");
+ &nicesystem("rsync -e $ssh -r --delete -a -v -c $localroot/ $distuser\@$disthost:$distdir/");
+
+}
+
+1;
+
diff --git a/packaging/utils/errcheck b/packaging/utils/errcheck
new file mode 100755
index 000000000..1a1ab5037
--- /dev/null
+++ b/packaging/utils/errcheck
@@ -0,0 +1,40 @@
+#! /bin/sh
+# internal utility for testing kernel make output for errors
+# Copyright (C) 1998, 1999 Henry Spencer.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# RCSID $Id: errcheck,v 1.1 2004/03/15 20:35:27 as Exp $
+
+# the errors.[och] stuff is for math emulation
+# the HiSax nonsense is due to a Red Hat 5.2 botch
+# RH7.2 "make dep" builds stuff in drivers/macintosh (!!) using <asm/init.h>
+# Red Hat's 2.2.19 whines about function read_rx_long_length_errors in e100.c
+# 2.4.18: 53c700.h:40:2: #error "Config.in must define either CONFIG_53C700_IO_MAPPED or CONFIG_53C700_MEM_MAPPED to use this scsi core."
+oops="`sed -e 's/-Werror/-Weror/g' \
+ -e '/errors*\.[och]/s/errors*\./eror./g' \
+ -e '/scsi_error/s//scsi_eror/' \
+ -e '/KBUILD_BASENAME=errors/s/errors/eror/g' \
+ -e '/#error .HiSax: No cards configured/s/error/eror/' \
+ -e '/#error .<asm.init.h> should never be used/s/error/eror/' \
+ -e '/53c700.h:[0-9:]* #error "Config.in must define either CONFIG_53C700_IO_MAPPED or CONFIG_53C700_MEM_MAPPED to use this scsi core."/s/error/eror/' \
+ -e '/^e100.c: In function/s/length_errors/length_erors/' $* |
+ egrep -i 'error|\*\*\*' | egrep -v ': warning:'`"
+if test " $oops" != " "
+then
+ echo
+ echo "***ERRORS DETECTED in $* (examine file for details):"
+ echo "$oops"
+ echo
+ exit 1
+else
+ exit 0
+fi
diff --git a/packaging/utils/kernel.patch.gen.sh b/packaging/utils/kernel.patch.gen.sh
new file mode 100644
index 000000000..0bc726dd1
--- /dev/null
+++ b/packaging/utils/kernel.patch.gen.sh
@@ -0,0 +1,52 @@
+#!/bin/bash
+#
+# RCSID $Id: kernel.patch.gen.sh,v 1.1 2004/03/15 20:35:27 as Exp $
+
+patchdir=`pwd`
+kernelsrc=/usr/src/linux
+[ "$1~" = "~" ] || kernelsrc=$1
+cd $kernelsrc
+# clean out destination file for all patch
+#echo "">$patchdir/all
+
+# find files to patch and loop
+for i in `find . -name '*.preipsec'`
+do
+
+# strip off '.preipsec' suffix
+j=${i%.preipsec}
+
+# strip off './' prefix
+k=${j#\.\/}
+
+# single unified diff
+#diff -u $i $j >>$patchdir/all
+
+# convert '/' in filename to '.' to avoid subdirectories
+sed -e 's/\//\./g' << EOI > /tmp/t
+$k
+EOI
+l=`cat /tmp/t`
+rm -f /tmp/t
+
+# *with* path from source root
+#echo do diff -u $i $j '>' $patchdir/$l
+echo found $i
+echo "RCSID \$Id: kernel.patch.gen.sh,v 1.1 2004/03/15 20:35:27 as Exp $" >$patchdir/$l
+diff -u $i $j >>$patchdir/$l
+
+done
+
+#
+# $Log: kernel.patch.gen.sh,v $
+# Revision 1.1 2004/03/15 20:35:27 as
+# added files from freeswan-2.04-x509-1.5.3
+#
+# Revision 1.6 2002/04/25 17:04:16 mcr
+# resurrected kernel.patch.gen.sh
+#
+# Revision 1.4 1999/04/06 04:54:30 rgb
+# Fix/Add RCSID Id: and Log: bits to make PHMDs happy. This includes
+# patch shell fixes.
+#
+#
diff --git a/packaging/utils/kerneldiff b/packaging/utils/kerneldiff
new file mode 100755
index 000000000..5cd4f73e2
--- /dev/null
+++ b/packaging/utils/kerneldiff
@@ -0,0 +1,35 @@
+#!/bin/sh
+
+# wander through a FreeSWAN linux directory, comparing each file to
+# a corresponding file in the argument $KERNELSRC directory, creating
+# a diff that can be used to update the FreeSWAN source tree.
+#
+# This script is useful if you have used "make kernelpatch" to patch
+# a kernel, and then had to edit the source code in the kernel tree.
+#
+# $Id: kerneldiff,v 1.1 2004/03/15 20:35:27 as Exp $
+#
+
+KERNELSRC=$1
+shift
+
+(cd linux && find . -type f -print) | grep -v CVS | egrep -v './Makefile' | while read file
+do
+ base=`basename $file`
+ case $base in
+ .cvsignore) ;;
+ .*.o.flags) ;;
+ *.o) ;;
+ *~) ;;
+ *.$patchname.patch) ;;
+ *.patch) ;;
+ *.orig) ;;
+ *.rej) ;;
+ version.c);;
+ *) diff -u linux/$file $KERNELSRC/$file ;;
+ esac
+done
+
+exit 0
+
+
diff --git a/packaging/utils/kernelpatch b/packaging/utils/kernelpatch
new file mode 100755
index 000000000..d2b8e86f1
--- /dev/null
+++ b/packaging/utils/kernelpatch
@@ -0,0 +1,55 @@
+#!/bin/sh
+
+# wander through a FreeSWAN linux directory, creating a patch file (to stdout)
+# that will apply the code to a kernel source directory.
+#
+# $Id: kernelpatch,v 1.1 2004/03/15 20:35:27 as Exp $
+#
+
+KERN=$1
+shift
+
+case $KERN in
+ 2.0) patchname=fs2_0;;
+ 2.2) patchname=fs2_2;;
+ 2.4) patchname=fs2_4;;
+ 2.5) patchname=fs2_5;;
+ *) echo "Invalid kernel patch target: $KERN"; exit 1;;
+esac
+
+# make sure that sort gets the right locale.
+LANG=C export LANG
+LC_ALL=C export LC_ALL
+
+
+find linux -type f -print | grep -v CVS | egrep -v 'linux/Makefile' | sort | while read file
+do
+ base=`basename $file`
+ case $base in
+ TAGS) ;;
+ tags) ;;
+ .cvsignore) ;;
+ .*.o.flags) ;;
+ .\#*);;
+ *.o) ;;
+ *~) ;;
+ tagsfile.mak) ;;
+ *.$patchname.patch) cat $file;;
+ *.patch) ;;
+ *) diff -u /dev/null $file;;
+ esac
+done
+
+#
+# finally, we have to produce a diff for linux/net/linux/Makefile.ver,
+# a file which is generated at runtime, so there is nothing in CVS.
+#
+echo '--- /dev/null Fri May 10 13:59:54 2002'
+echo '+++ linux/net/ipsec/Makefile.ver Sun Jul 28 22:10:40 2002'
+echo '@@ -0,0 +1 @@'
+echo -n '+'
+grep IPSECVERSION Makefile.ver
+
+exit 0
+
+
diff --git a/packaging/utils/kernelversion b/packaging/utils/kernelversion
new file mode 100755
index 000000000..a021398af
--- /dev/null
+++ b/packaging/utils/kernelversion
@@ -0,0 +1,10 @@
+#! /bin/sh
+# determine kernel version code, mostly for use in RPM building
+
+awk 'BEGIN { FS = " *= *" }
+ NF != 2 { next }
+ $1 == "VERSION" { maj = $2 }
+ $1 == "PATCHLEVEL" { mid = $2 }
+ $1 == "SUBLEVEL" { min = $2 }
+ $1 == "EXTRAVERSION" { ext = $2 }
+ END { print maj "." mid "." min ext }' $*
diff --git a/packaging/utils/kernelversion-short b/packaging/utils/kernelversion-short
new file mode 100755
index 000000000..677f7b4da
--- /dev/null
+++ b/packaging/utils/kernelversion-short
@@ -0,0 +1,8 @@
+#! /bin/sh
+# determine kernel version code, mostly for use in RPM building
+
+awk 'BEGIN { FS = " *= *" }
+ NF != 2 { next }
+ $1 == "VERSION" { maj = $2 }
+ $1 == "PATCHLEVEL" { mid = $2 }
+ END { print maj "." mid }' $*
diff --git a/packaging/utils/manlink b/packaging/utils/manlink
new file mode 100755
index 000000000..84e6031b2
--- /dev/null
+++ b/packaging/utils/manlink
@@ -0,0 +1,74 @@
+#! /bin/sh
+#
+# $Id: manlink,v 1.1 2004/03/15 20:35:27 as Exp $
+#
+# make list of alternate names for manpages
+
+PATH=/bin:/usr/bin ; export PATH
+usage="$0 manpage ..."
+
+for m
+do
+ bm=`basename $m`
+ if test ! -f $m
+ then
+ echo "$0: cannot find \`$m'" >&2
+ exit 1
+ fi
+ suf=$(expr $bm : '.*\([.][^.][^.]*\)$')
+
+ # a .\"+ line rules
+ them=$(awk '/^\.\\"\+[ ]/ { for (i = 2; i <= NF; i++) print $i }' $m)
+
+ # otherwise, try to intuit the list of names from the NAME section
+ if test " $them" = " "
+ then
+ them=$( awk '/^\.SH[ \t]+NAME/,/^\.SH[ \t]+[^N]/' $m |
+ egrep -v '^\.' | tr ' ,' ' ' |
+ sed -n '/ *\\*- *.*/s///p' | tr -s ' ' '\012' |
+ egrep -v '^ipsec$' )
+ fi
+
+ # do it
+ for f in $them
+ do
+ case $f in
+ ipsec*) ff="$f" ;; # ipsec.8, ipsec.conf.5, etc.
+ *) ff="ipsec_$f" ;;
+ esac
+ case $ff in
+ *.[1-8]) ;;
+ *) ff="$ff$suf" ;;
+ esac
+ #echo "Q: $bm FF: $ff" >&2
+ if [ " $ff" != " $bm" ] && [ " $ff" != " ipsec_$bm" ]
+ then
+ echo $bm $ff
+ fi
+ done
+done
+
+#
+# $Log: manlink,v $
+# Revision 1.1 2004/03/15 20:35:27 as
+# added files from freeswan-2.04-x509-1.5.3
+#
+# Revision 1.8 2002/09/17 20:17:16 sam
+#
+# The "make doc" fix broke "make install" silently; some man page symlinks
+# were being linked incorrectly. This resulted in files which passed the make
+# install test but linked to nothing.
+#
+# Revision 1.7 2002/08/07 06:23:35 sam
+#
+# freeswan/packaging/utils/manlink
+#
+# Revision 1.6 2002/05/06 21:20:24 mcr
+# manlink -n idea is a fail. It depended upon being able to
+# read the man page at the installed location, which isn't going
+# to work consistently. manlink now just generates a list of links
+# that should be made, leaving the Makefile script to decide what
+# to do with them. Further, it now processes the files found in the
+# repository, rather than the ones installed.
+#
+#
diff --git a/packaging/utils/maysnap b/packaging/utils/maysnap
new file mode 100755
index 000000000..9685c1d20
--- /dev/null
+++ b/packaging/utils/maysnap
@@ -0,0 +1,41 @@
+#! /bin/sh
+# consider making snapshot of FreeSwan code
+
+who=mcr
+USER=build export USER
+
+. ~build/freeswan-regress-env.sh
+
+umask 022
+
+cd ~build/WANTSNAP
+
+if test ! -f dosnap
+then
+ exit 0
+fi
+
+set -x
+
+if test -f doingsnap
+then
+ echo "snapshot already in progress" | mail -s "snapshot averted" $who
+ exit 0
+fi
+
+echo $$ >doingsnap
+sort -u dosnap >/tmp/snap$$
+echo === >>/tmp/snap$$
+if ~build/bin/mksnap -S >>/tmp/snap$$ 2>&1
+then
+ #if ~build/bin/mksnap -r 1.97 -p pre1.98 >>/tmp/snap$$ 2>&1
+ #then
+ rm -f dosnap
+ #fi
+fi
+
+mail -s "snapshot report $reqd" $who </tmp/snap$$
+rm -f /tmp/snap$$ doingsnap
+
+find /btmp/build/snapshots -type f -ctime +5 -print | xargs -r rm
+
diff --git a/packaging/utils/maytest b/packaging/utils/maytest
new file mode 100755
index 000000000..6bc08da11
--- /dev/null
+++ b/packaging/utils/maytest
@@ -0,0 +1,42 @@
+#! /bin/sh
+# consider making snapshot of FreeSwan code
+
+who=mcr
+USER=build export USER
+
+. ~build/freeswan-regress-env.sh
+
+umask 022
+
+cd ~build/WANTSNAP
+
+if test ! -f dotest
+then
+ exit 0
+fi
+
+if test -f doingtest
+then
+ exit 0
+fi
+
+trap "rm -f ~build/WANTSNAP/doingtest ~build/WANTSNAP/dotest; exit 0" 0 1 2 15
+
+set -x
+
+echo $$ >doingtest
+sort -u doingtest >/tmp/nightly$$
+echo === >>/tmp/test$$
+if ~build/bin/nightly.sh >>/tmp/snap$$ 2>&1
+then
+ rm -f doingtest
+ rm -f dotest
+fi
+
+mail -s "nightly test report $reqd" $who </tmp/nightly$$
+rm -f /tmp/nightly$$ dotest
+
+# kill any wayward linux processes
+killuml linux
+
+
diff --git a/packaging/utils/mkcand b/packaging/utils/mkcand
new file mode 100755
index 000000000..91e69f62b
--- /dev/null
+++ b/packaging/utils/mkcand
@@ -0,0 +1,126 @@
+#!/usr/bin/perl
+# mkcand m.nn
+# package candidate, leaving it in tmp directory
+
+require($ENV{'HOME'}."/bin/disttools.pl");
+
+&defvars;
+&suckvars;
+
+umask(022);
+
+$localdir=$ENV{'HOME'}."/archive";
+$ENV{'DEV_DIR'}=$localdir."/development";
+$tmpdir=$ENV{'BTMP'}."/".$ENV{'USER'}."/snapshots";
+
+$transmit=1;
+$snapprefix="";
+$tarinfix="";
+$date="now";
+$lastrel=$ENV{'LASTREL'};
+
+sub usage {
+ print STDERR "mkcand:\n";
+ print STDERR "\t-l do not transmit\n";
+ print STDERR "\t-p name set candidate name\n";
+ print STDERR "\t-r rel set release branch\n";
+}
+
+while(@ARGV) {
+ $_=shift;
+
+ if(/^-l/) {
+ $transmit=0;
+
+ } elsif(/^-S/) {
+ $symlink=1;
+
+ } elsif(/^-p/) {
+ $rel=shift;
+ $snapprefix="pre$rel-";
+
+ } elsif(/^-r/) {
+ $arg=shift;
+ ($lastrel=$arg) =~ y/\./\_/;
+ $relopt="-r PRE${lastrel}"
+
+# } elsif(/^-d/) {
+# $arg=shift;
+# $transmit=0;
+# $date=$arg;
+
+ } else {
+ &usage;
+ exit;
+ }
+}
+
+
+
+if(!defined($relopt) ||
+ !defined($rel)) {
+ &usage;
+ exit;
+}
+
+if($rel < 2.00) {
+ undef(@supportedkernels);
+}
+
+
+$candname=&snapname($snapprefix);
+$dirname="freeswan-cand".$candname;
+# $pkgname="candidate-".$candname;
+$pkgname=$dirname;
+$tarname=$pkgname.".tar";
+$vername="cand-".$candname;
+
+&nicesystem("mkdir -p $tmpdir");
+print "BUILDING candidate $candname in $dirname\n";
+if($transmit) {
+ print "WILL TRANSMIT TO $ENV{'DISTHOST'}\n"
+} else {
+ print "WILL NOT TRANSMIT\n";
+}
+
+&setuppgp($lastrel);
+
+&makedisttarfile($tmpdir, $pkgname, $vername, $dirname, $date, $relopt, 1);
+
+unlink("CANDIDATE.tar.gz");
+&nicesystem("ln $tarname.gz CANDIDATE.tar.gz") || die "failed to symlink to CANDIDATE.tar.gz: $?\n";
+&nicesystem("md5sum CANDIDATE.tar.gz >CANDIDATE.tar.gz.md5") || die "failed to md5sum of CANDIDATE.tar.gz: $?\n";
+
+&dopgpsig($pkgname);
+
+&nicesystem("pgp -kxa $ENV{'PGPNAME'} $pkgname.tar.gz.pgpkey && chmod +r $pkgname.tar.gz.pgpkey.asc");
+
+if($transmit) {
+ system("date");
+
+ local($snapprefix);
+
+ &upload($pkgname);
+
+ if($symlink) {
+ &sendfiles("CANDIDATE.tar.gz.md5");
+
+ &remotecmd("cd ".$ENV{'DISTDIR'}." && ln -f -s $pkgname.tar.gz CANDIDATE.tar.gz && ln -f -s $tarname.gz.sig CANDIDATE.tar.gz.sig");
+
+ foreach $ver (@supportedkernels) {
+ &remotecmd("cd ".$ENV{'DISTDIR'}." && ln -f -s $pkgname$ver.patch.gz CAND.KERN$ver.gz && ln -f -s $tarname.gz.sig CAND.KERN$ver.gz.sig");
+ }
+ }
+
+ print "Cleaning up old candidates\n";
+
+ local($file, $localroot);
+
+ $localroot=$ENV{'DEV_DIR'};
+ &nicesystem("cd $localroot && find . -mtime +3 | grep 'freeswan-cand$snapprefix' | xargs rm");
+
+ &upsync;
+
+ system("date");
+}
+
diff --git a/packaging/utils/mkrel b/packaging/utils/mkrel
new file mode 100755
index 000000000..3182d9d06
--- /dev/null
+++ b/packaging/utils/mkrel
@@ -0,0 +1,95 @@
+#!/usr/bin/perl
+# mkcand m.nn
+# package candidate, leaving it in tmp directory
+
+require($ENV{'HOME'}."/bin/disttools.pl");
+
+&defvars;
+&suckvars;
+
+umask(022);
+
+$localdir=$ENV{'HOME'}."/archive";
+
+$tmpdir=$ENV{'BTMP'}."/".$ENV{'USER'}."/snapshots";
+
+$transmit=1;
+$snapprefix="";
+$tarinfix="";
+$date="";
+$lastrel=$ENV{'LASTREL'};
+
+sub usage {
+ print STDERR "mkrel:\n";
+ print STDERR "\t-l do not transmit\n";
+ print STDERR "\t-p name set release name\n";
+ print STDERR "\t-r rel set release branch\n";
+}
+
+while(@ARGV) {
+ $_=shift;
+
+ if(/^-l/) {
+ $transmit=0;
+
+ } elsif(/^-S/) {
+ $symlink=1;
+
+ } elsif(/^-p/) {
+ $rel=shift;
+ $snapprefix="pre$rel-";
+
+ } elsif(/^-r/) {
+ $arg=shift;
+ ($lastrel=$arg) =~ y/\./\_/;
+ $relopt="-r PRE${lastrel}"
+
+ } else {
+ &usage;
+ exit;
+ }
+}
+
+if(!defined($relopt) ||
+ !defined($rel)) {
+ &usage;
+ exit;
+}
+
+$dirname="freeswan-".$rel;
+$pkgname="freeswan-".$rel;
+$tarname=$pkgname.".tar";
+$vername=$rel;
+
+&nicesystem("mkdir -p $tmpdir");
+print "BUILDING release $rel in $dirname\n";
+if($transmit) {
+ print "WILL TRANSMIT TO $ENV{'DISTHOST'}\n"
+} else {
+ print "WILL NOT TRANSMIT\n";
+}
+
+$ENV{'PGPPATH'}="/mnt/build/freeswan";
+$ENV{'PGPNAME'}="build\@freeswan.org";
+
+&makedisttarfile($tmpdir, $pkgname, $vername, $dirname, $date, $relopt, 1);
+
+print "Please insert release key floppy for signature";
+$ans=<STDIN>;
+system("mount /mnt/build");
+&dopgpsig($pkgname);
+system("umount /mnt/build");
+
+if($transmit) {
+ print "Now transmitting to XS4all\n";
+ print "Starting on: ";
+ system("date");
+
+ &upload($pkgname);
+
+ &upsync;
+
+ print "Finished on: ";
+ system("date");
+}
+
diff --git a/packaging/utils/mksnap b/packaging/utils/mksnap
new file mode 100755
index 000000000..4f336fc7a
--- /dev/null
+++ b/packaging/utils/mksnap
@@ -0,0 +1,114 @@
+#!/usr/bin/perl
+# make snapshot of FreeSwan code
+# -l local build only, do not transmit
+# -p nn pre-nn version (where nn is a release like 1.00)
+# -d ddd build as of date ddd (implies -l)
+
+require($ENV{'HOME'}."/bin/disttools.pl");
+
+&defvars;
+&suckvars;
+
+umask(022);
+
+$localdir=$ENV{'HOME'}."/archive";
+$ENV{'DEV_DIR'}=$localdir."/development";
+
+if(!defined($ENV{'USER'})) {
+ $ENV{'USER'}="build";
+}
+
+$tmpdir=$ENV{'BTMP'}."/".$ENV{'USER'}."/snapshots";
+
+$transmit=1;
+$symlink=0;
+$snapprefix="";
+$tarinfix="";
+$relopt="";
+$date="now";
+$lastrel=$ENV{'LASTREL'};
+$lastrel =~ y/\./\_/;
+
+while(@ARGV) {
+ $_=shift;
+
+ if(/^-l/) {
+ $transmit=0;
+
+ } elsif(/^-D/) {
+ $debug++;
+
+ } elsif(/^-S/) {
+ $symlink=1;
+
+ } elsif(/^-p/) {
+ $arg=shift;
+ $snapprefix="$arg-";
+
+ } elsif(/^-r/) {
+ $arg=shift;
+ ($lastrel=$arg) =~ y/\./\_/;
+ $relopt="-r PRE${lastrel}"
+
+# } elsif(/^-d/) {
+# $arg=shift;
+# $transmit=0;
+# $date=$arg;
+
+ } else {
+ print STDERR "mksnap:\n";
+ print STDERR "\t-l do not transmit\n";
+ print STDERR "\t-p stuff set snapshot prefix\n";
+ print STDERR "\t-r rel set release branch\n";
+ print STDERR "\t-d date set snapshot date\n";
+ exit;
+ }
+}
+
+$snapname=&snapname($snapprefix);
+
+#if($date ne "now") {
+# $snapname="`echo $date | tr -d ' :'`" ;;
+#}
+
+$dirname="freeswan-snap".$snapname;
+$pkgname="snapshot-".$snapname;
+$tarname=$pkgname.".tar";
+
+&nicesystem("mkdir -p $tmpdir");
+print "BUILDING snapshot $dirname\n";
+if($transmit) {
+ print "WILL TRANSMIT TO $ENV{'DISTHOST'}\n"
+} else {
+ print "WILL NOT TRANSMIT\n";
+}
+
+&setuppgp($lastrel);
+
+&makedisttarfile($tmpdir, $pkgname, "$lastrel_$snapname", $dirname, $date, $relopt, 0);
+
+unlink("snapshot.tar.gz");
+&nicesystem("ln -s $tarname.gz snapshot.tar.gz") || die "failed to symlink to snapshot.tar.gz: $?\n";
+&nicesystem("md5sum snapshot.tar.gz >snapshot.tar.gz.md5") || die "failed to md5sum of snapshot.tar.gz: $?\n";
+
+&dopgpsig($pkgname);
+
+if($transmit) {
+ system("date");
+
+ &upload($pkgname, "snapshot");
+
+ print "Cleaning up old snapshots\n";
+
+ local($file, $localroot);
+
+ $localroot=$ENV{'DEV_DIR'};
+
+ &nicesystem("cd $localroot && find . -name \"snapshot-*\" -print | grep -v $pkgname | xargs -r rm --");
+
+ &upsync;
+
+ system("date");
+}
+
+
diff --git a/packaging/utils/mvcand b/packaging/utils/mvcand
new file mode 100755
index 000000000..6e29bc490
--- /dev/null
+++ b/packaging/utils/mvcand
@@ -0,0 +1,62 @@
+#! /bin/sh
+# mvcand
+# move packaged candidate to distribution site (password supplied manually)
+
+PATH=/bin:/usr/bin
+export PATH
+umask 022
+
+. $HOME/freeswan-regress-env.sh
+
+localplace=~build/archive
+site=freeswan@xs4.xs4all.nl
+place=FTP
+linkname=CANDIDATE.tar
+ssh=/usr/bin/ssh
+scp=/usr/bin/scp
+
+localonly=
+remove=yes
+for dummy
+do
+ case "$1" in
+ -l) localonly=yes ;;
+ -k) remove= ;;
+ --) shift ; break ;;
+ -*) echo "$0: unknown option \'$1'" >&2 ; exit 2 ;;
+ *) break ;;
+ esac
+ shift
+done
+
+case "$#" in
+0) ;;
+*) echo "Usage: $0" >&2 ; exit ;;
+esac
+
+cd ~build/tmp
+tarname=`ls | sed -n '/^freeswan-.*\.gz$/s/\.gz$//p' | tail -1`
+echo "moving $tarname.gz"
+
+(
+ cd $localplace
+ rm -f freeswan-cand* $linkname.*
+ ln -s $tarname.gz $linkname.gz
+)
+cp -p $tarname.gz $tarname.gz.md5 $tarname.gz.sig CANDIDATE.tar.gz.md5 $localplace
+
+if test "$localonly"
+then
+ exit 0 # leaving the original around
+fi
+
+$ssh $site "cd $place ; rm -f freeswan-cand* $linkname.* ;
+ ln -s $tarname.gz $linkname.gz ;
+ ln -s $tarname.gz.sig $linkname.gz.sig"
+
+$scp -p $tarname.gz.md5 $tarname.gz.sig $tarname.gz CANDIDATE.tar.gz.md5 $site:$place
+
+if test "$remove"
+then
+ rm -f $tarname.*
+fi
diff --git a/packaging/utils/mvrel b/packaging/utils/mvrel
new file mode 100755
index 000000000..66b1180a8
--- /dev/null
+++ b/packaging/utils/mvrel
@@ -0,0 +1,65 @@
+#! /bin/sh
+# mvrel major minor
+# move packaged release to distribution site (password supplied manually)
+
+PATH=/bin:/usr/bin
+export PATH
+umask 022
+
+. $HOME/freeswan-regress-env.sh
+
+localplace=~build/archive
+site=freeswan@xs4.xs4all.nl
+place=FTP
+linkname=LATEST.tar
+ssh=/usr/bin/ssh
+scp=/usr/bin/scp
+
+localonly=
+remove=yes
+for dummy
+do
+ case "$1" in
+ -l) localonly=yes ;;
+ -c) site=adams.freeswan.org ; place=/home/team ; scp=scp2 ; ssh=ssh2 ;;
+ -k) remove= ;;
+ --) shift ; break ;;
+ -*) echo "$0: unknown option \'$1'" >&2 ; exit 2 ;;
+ *) break ;;
+ esac
+ shift
+done
+
+case "$#:$1" in
+1:*.*) ;;
+*) echo "Usage: $0 [-l] [-c] release" >&2 ; exit ;;
+esac
+
+tarname=freeswan-$1.tar
+
+cd ~build/tmp
+if test ! -r $tarname.gz
+then
+ echo "$0: no $tarname.gz!" >&2
+ exit 1
+fi
+
+rm -f $localplace/$tarname.*
+cp -p $tarname.gz $tarname.gz.sig $localplace
+
+if test "$localonly"
+then
+ exit 0 # leaving the original around
+fi
+
+$ssh $site "cd $place ; rm -f $tarname.gz.sig $tarname.gz LATEST.* ;
+ rm -f CANDIDATE.* freeswan-cand* ;
+ mv freeswan-[0-9]* old ;
+ ln -s $tarname.gz LATEST.tar.gz ;
+ ln -s $tarname.gz.sig LATEST.tar.gz.sig"
+$scp -p $tarname.gz.sig $tarname.gz $site:$place
+
+if test "$remove"
+then
+ rm -f $tarname.*
+fi
diff --git a/packaging/utils/patcher b/packaging/utils/patcher
new file mode 100755
index 000000000..ba31bdd26
--- /dev/null
+++ b/packaging/utils/patcher
@@ -0,0 +1,188 @@
+#! /bin/sh
+# smart patch applier
+# Copyright (C) 1999, 2001 Henry Spencer.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the
+# Free Software Foundation; either version 2 of the License, or (at your
+# option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# patcher [-v] [-c] targetdir target [ key patchfile ] ...
+# In targetdir, patch target from patchfile unless it already contains
+# key and it appears to have been patched with the same patch. (If the
+# patch has changed, undo the old one and then put the new one in.) Save
+# original as target.preipsec, and patched copy as target.wipsec, with
+# patch md5sum stored as target.ipsecmd5. If the patch doesn't work,
+# put the original back and save the patch attempt as target.mangled.
+# If there are no key+patchfile pairs, undo any old patch and leave it
+# at that.
+# -v means verbose
+# -c means do "patching" by appending rather than by using patch(1)
+#
+# RCSID $Id: patcher,v 1.1 2004/03/15 20:35:27 as Exp $
+
+PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
+export PATH
+umask 022
+
+verbose=
+modifier=patch
+for dummy
+do
+ case "$1" in
+ -v) verbose=yes ;;
+ -c) modifier=cat ;;
+ --) shift ; break ;;
+ -*) echo "$0: unknown option \`$1'" >&2 ; exit 2 ;;
+ *) break ;;
+ esac
+ shift
+done
+if test $# -lt 2
+then
+ echo "Usage: $0 [-v] [-c] targetdir target [ key patchfile ] ..." >&2
+ exit 2
+fi
+
+need() {
+ if test ! -f $1
+ then
+ echo "$0: cannot find file \`$1'" >&2
+ exit 1
+ fi
+}
+
+note() {
+ if test "$verbose"
+ then
+ echo "* $1"
+ fi
+}
+
+dir="$1"
+target="$2"
+shift ; shift
+it=$dir/$target
+need $it
+
+
+
+patches=
+if test ! -s $it.ipsecmd5
+then
+ # no records of patching...
+ while test $# -ge 2
+ do
+ key="$1"
+ patchfile="$2"
+ shift ; shift
+ need $patchfile
+
+ if egrep -q "$key" $it
+ then
+ # patched but no record of how
+ note "$it no longer needs patch $patchfile"
+ else
+ patches="$patches $patchfile"
+ fi
+ done
+elif test ! -f $it.preipsec -o ! -f $it.wipsec
+then
+ echo "$0: $it.preipsec or .wipsec is missing!" >&2
+ exit 1
+else
+ # determine whether patches have changed
+ tmp=/tmp/patcher.$$
+ >$tmp
+ while test $# -ge 2
+ do
+ key="$1"
+ patchfile="$2"
+ shift ; shift
+ need $patchfile
+ md5sum $patchfile | awk '{print $1}' >>$tmp
+
+ if egrep -q "$key" $it.preipsec
+ then
+ note "$it no longer needs patch $patchfile"
+ else
+ patches="$patches $patchfile"
+ fi
+ done
+ if cmp -s $tmp $it.ipsecmd5
+ then
+ note "$it already fully patched"
+ rm -f $tmp
+ exit 0
+ fi
+ rm -f $tmp
+
+ # must undo old patch(es)
+ note "$it old patches must be undone, undoing them..."
+ if ! cmp -s $it $it.wipsec
+ then
+ note "$it has changed, cannot undo old patches!"
+ echo "$0: cannot unpatch $it, it has changed since patching" >&2
+ exit 1
+ fi
+ rm $it
+ mv $it.preipsec $it
+ rm $it.wipsec $it.ipsecmd5
+fi
+
+# if no necessary patches, we're done
+if test " $patches" = " "
+then
+ note "$it no longer needs patching"
+ exit 0
+fi
+
+# try to figure out patch options
+if test " $modifier" = " patch"
+then
+ if patch --help >/dev/null 2>/dev/null
+ then
+ # looks like a modern version
+ popts='-p1 -b'
+ else
+ # looks like an old one
+ popts='-p1'
+ fi
+fi
+
+# do it
+>$it.ipsecmd5
+for patchfile in $patches
+do
+ note "applying $patchfile to $it..."
+
+ # make local copy - this defeats hard and soft links
+ mv $it $it.preipsec || exit 0
+ rm -f $it
+ cp -p $it.preipsec $it
+
+ case "$modifier" in
+ patch) ( cd $dir ; patch $popts ) <$patchfile ;;
+ cat) cat $patchfile >>$it ;;
+ esac
+ status=$?
+ if test $status -ne 0
+ then
+ note "$it patch failed, restoring original"
+ echo "$0: patch on $it failed!" >&2
+ echo "$0: restoring original $it," >&2
+ echo "$0: leaving patch attempt in $it.mangled" >&2
+ mv $it $it.mangled
+ mv $it.preipsec $it
+ rm -f $it.ipsecmd5
+ exit 1
+ fi
+ rm -f $it.orig # some patch versions leave debris
+ md5sum $patchfile | awk '{print $1}' >>$it.ipsecmd5
+done
+cp -p $it $it.wipsec
diff --git a/packaging/utils/prepcand b/packaging/utils/prepcand
new file mode 100755
index 000000000..31c382501
--- /dev/null
+++ b/packaging/utils/prepcand
@@ -0,0 +1,33 @@
+#! /bin/sh
+# prepcand m.nn
+# prepare candidate for building, must be done in top working dir
+
+PATH=/bin:/usr/bin
+export PATH
+umask 022
+
+case "$#:$1" in
+1:*.*) ;;
+*) echo "Usage: $0 release" >&2 ; exit ;;
+esac
+
+rel="$1"
+tag="PRE`echo $rel | tr '.' '_'`"
+
+# update from snapshot form to candidate/release form, if necessary
+if egrep -q -e '^---$' README
+then
+ sed '1,/^---$/d' README | sed '1s/This is release xxx of Linux FreeS\/WAN/This is release '$rel' of Linux FreeS\/WAN/' > README.$$
+ mv README.$$ README
+ cvs -Q commit -m "update for candidates of release $rel" README
+fi
+
+if sed -n 1p CHANGES | egrep -q 'since last release'
+then
+ sed '1s/since last release/in '$rel'/' CHANGES >CHANGES.$$
+ mv CHANGES.$$ CHANGES
+ cvs -Q commit -m "update for candidates of release $rel" CHANGES
+fi
+
+echo "IPSECVERSION=$rel" >Makefile.ver
+cvs -Q commit -m "update for candidate of release $rel" Makefile
diff --git a/packaging/utils/recan b/packaging/utils/recan
new file mode 100755
index 000000000..eaaf9436a
--- /dev/null
+++ b/packaging/utils/recan
@@ -0,0 +1,17 @@
+#! /bin/sh
+# recan release
+# run in a working directory to recan contents of same where necessary
+
+PATH=/bin:/usr/bin ; export PATH
+umask 022
+
+. ~freeswan/setup
+
+case $# in
+0) echo "Usage: $0 release [file] ..." >&2 ; exit 2 ;;
+esac
+
+tag="R`echo $1 | tr '.' '_'`"
+shift
+
+cvs tag -F -D now $tag $*
diff --git a/packaging/utils/setup b/packaging/utils/setup
new file mode 100755
index 000000000..5d250bb37
--- /dev/null
+++ b/packaging/utils/setup
@@ -0,0 +1,9 @@
+# shell file setting up environment for freeswan CVS access
+# This is here, rather than in .profiles, because Henry has local access
+# and doesn't want to duplicate this stuff.
+
+PATH=$PATH:/sandel/bin export PATH
+CVSROOT=/freeswan/MASTER
+CVSUMASK=002
+
+export CVSROOT CVSUMASK
diff --git a/packaging/utils/sshenv b/packaging/utils/sshenv
new file mode 100755
index 000000000..8075b9d09
--- /dev/null
+++ b/packaging/utils/sshenv
@@ -0,0 +1,4 @@
+# ssh environment file for freeswan CVS access
+# user .ssh directories have links to this, so this info is in one place
+CVSROOT=/home/freeswan/cvs
+CVSUMASK=002
diff --git a/packaging/utils/tattle b/packaging/utils/tattle
new file mode 100755
index 000000000..37d015b0f
--- /dev/null
+++ b/packaging/utils/tattle
@@ -0,0 +1,33 @@
+#! /bin/sh
+# tattle [-f] subject address ...
+# report a freeswan CVS change made by someone other than "owner" of files
+
+PATH=/bin:/usr/bin ; export PATH
+
+noself=yes # don't mail to person making change
+case "$1" in
+-f) noself= ; shift ;;
+esac
+
+msg="freeswan commit: $1"
+shift
+
+them=
+if test "$noself"
+then
+ iam="`id -un`"
+ for who
+ do
+ if test " $who" != " $iam"
+ then
+ them="$them $who"
+ fi
+ done
+else
+ them="$*"
+fi
+
+if test " $them" != " "
+then
+ mail -s "$msg" $them
+fi
diff --git a/packaging/utils/wantsnap b/packaging/utils/wantsnap
new file mode 100755
index 000000000..74b4287da
--- /dev/null
+++ b/packaging/utils/wantsnap
@@ -0,0 +1,3 @@
+#! /bin/sh
+umask 002
+id -un >>~build/WANTSNAP/dosnap
diff --git a/packaging/utils/wanttest b/packaging/utils/wanttest
new file mode 100755
index 000000000..9cbdde8d0
--- /dev/null
+++ b/packaging/utils/wanttest
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+if [ -f ~build/WANTSNAP/doingtest ]
+then
+ echo Test already in progress.
+ exit 1
+fi
+
+umask 002
+id -un >>~build/WANTSNAP/dotest