Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sbin/mount_portal/examples Add another example that shows ho...
details: https://anonhg.NetBSD.org/src/rev/cafa42a100cd
branches: trunk
changeset: 515978:cafa42a100cd
user: atatat <atatat%NetBSD.org@localhost>
date: Thu Oct 11 18:41:11 2001 +0000
description:
Add another example that shows how to map a cvs server into your local
file system so that you can pull random files out of it easily.
diffstat:
sbin/mount_portal/examples/Makefile | 5 +-
sbin/mount_portal/examples/cvs.1 | 78 +++++++++++++++++++++++++++++++++++++
sbin/mount_portal/examples/cvs.conf | 3 +
sbin/mount_portal/examples/cvs.pl | 32 +++++++++++++++
sbin/mount_portal/examples/overview | 4 +-
5 files changed, 119 insertions(+), 3 deletions(-)
diffs (162 lines):
diff -r 6489c894dc92 -r cafa42a100cd sbin/mount_portal/examples/Makefile
--- a/sbin/mount_portal/examples/Makefile Thu Oct 11 18:02:28 2001 +0000
+++ b/sbin/mount_portal/examples/Makefile Thu Oct 11 18:41:11 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.1 1999/08/16 06:42:48 bgrayson Exp $
+# $NetBSD: Makefile,v 1.2 2001/10/11 18:41:11 atatat Exp $
.include <bsd.own.mk>
@@ -6,7 +6,8 @@
FILESDIR= /usr/share/examples/mount_portal
FILES= overview advanced.1 advanced.1.conf fing.c rfilter.1 \
- rfilter.2 rfilter.2.conf tcp.1 tcp.1.conf fs.1 fs.1.conf
+ rfilter.2 rfilter.2.conf tcp.1 tcp.1.conf fs.1 fs.1.conf \
+ cvs.1 cvs.conf cvs.pl
.endif
.include <bsd.prog.mk>
diff -r 6489c894dc92 -r cafa42a100cd sbin/mount_portal/examples/cvs.1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sbin/mount_portal/examples/cvs.1 Thu Oct 11 18:41:11 2001 +0000
@@ -0,0 +1,78 @@
+The cvs.conf portal configuration file maps the NetBSD anoncvs
+respository into the local file system. This means you can cat(1)
+or cp(1) copies of any arbitrary file or revision from the cvs
+server using a local path. Start off like this:
+
+ # mkdir /p
+ # mount -t portal `pwd`/cvs.conf /p
+ # chmod +x cvs.pl
+ #
+
+The next step is to set up the authentication. The NetBSD anoncvs
+server uses ssh for authentication, so all you need to do is
+
+ # ssh anoncvs%anoncvs.netbsd.org@localhost
+
+and answer 'yes' when it asks you if you want to accept the key.
+Now the NetBSD source tree is close at hand.
+
+First, some caveats. File name completion and globbing don't work,
+and diff has difficulties with this since it stat()s the file names
+it's given and gets back more or less meaningless information for
+names under a portal file system. You also need to have perl
+installed for the cvs.pl script that supports this configuration.
+The script expects to find perl in /usr/pkg/bin, so change the
+script if you have perl installed somewhere else.
+
+Here's a list of things I've done with this:
+
+1) diff one of my files (eg, /etc/security) against the repository
+
+ % grep NetBSD: /etc/security
+ # $NetBSD: security,v 1.52 ...
+ % diff -u -< /p/netbsd/basesrc/etc/security,1.52 /etc/security
+ [ diffs elided ]
+ %
+
+Notice the use of the - file given to diff and the input redirection
+so that it will read from stdin instead of opening the file itself.
+This gets around the stat() problem.
+
+2) Check out some (or all) versions of a file:
+
+ % grep NetBSD: /etc/security
+ # $NetBSD: security,v 1.52 ...
+ % foreach i (`jot 10 43`)
+ > cp /p/netbsd/basesrc/etc/security,1.$i /tmp
+ > end
+ %
+
+Presto! Versions 1.43 through 1.52 (jot(1) prints 10 numbers
+starting at 43) of /etc/security are copied into your /tmp directory
+so that you can do arbitrary diffs between any version you like.
+You can use tags instead of revision numbers if you like.
+
+3) Instant upgrades. Since cvs always defaults to the head of the
+trunk, you can do this:
+
+ # cp /p/netbsd/basesrc/etc/security /etc/security
+ #
+
+to upgrade to the latest and greatest version any time you like,
+or you can do this:
+
+ # uname -r
+ 1.5.2
+ # cp /p/netbsd/basesrc/etc/security,netbsd-1-5-PATCH002 /etc/security
+ #
+
+to get rid of any changes you might have made to /etc/security that
+you no longer want.
+
+Note that there's some support for the FreeBSD and OpenBSD anoncvs
+service in there as well, but those might be tricky. The FreeBSD
+anoncvs server only offers pserver access, so you'll need to manually
+do a cvs login to make that work. The OpenBSD server seems to move
+around a fair amount, so the CVSROOT value for it will need to be
+updated if that happens again. You might also choose to use
+different servers entirely.
diff -r 6489c894dc92 -r cafa42a100cd sbin/mount_portal/examples/cvs.conf
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sbin/mount_portal/examples/cvs.conf Thu Oct 11 18:41:11 2001 +0000
@@ -0,0 +1,3 @@
+netbsd/ rfilter netbsd/ /usr/share/examples/mount_portal/cvs.pl netbsd %s
+freebsd/ rfilter freebsd/ /usr/share/examples/mount_portal/cvs.pl freebsd %s
+openbsd/ rfilter openbsd/ /usr/share/examples/mount_portal/cvs.pl openbsd %s
diff -r 6489c894dc92 -r cafa42a100cd sbin/mount_portal/examples/cvs.pl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sbin/mount_portal/examples/cvs.pl Thu Oct 11 18:41:11 2001 +0000
@@ -0,0 +1,32 @@
+#!/usr/pkg/bin/perl
+
+# ensure that HOME is set for pserver modes
+$ENV{'HOME'} = (getpwuid($<))[7] || "/";
+# supplement path to include ssh and cvs
+$ENV{'PATH'} = "/usr/pkg/bin:$ENV{'PATH'}";
+# use ssh instead of rsh for cvs connections
+$ENV{'CVS_RSH'} = "ssh";
+
+if ($ARGV[0] eq "netbsd") {
+ $ENV{'CVSROOT'} = "anoncvs\@anoncvs.netbsd.org:/cvsroot";
+ shift(@ARGV);
+}
+elsif ($ARGV[0] eq "freebsd") {
+ $ENV{'CVSROOT'} = ":pserver:anoncvs\@anoncvs.freebsd.org:/home/ncvs";
+ shift(@ARGV);
+}
+elsif ($ARGV[0] eq "openbsd") {
+ $ENV{'CVSROOT'} = "anoncvs\@anoncvs.usa.openbsd.org:/cvs";
+ shift(@ARGV);
+}
+else {
+ print("configuration not supported\n");
+ exit(0);
+}
+
+foreach $file (@ARGV) {
+ ($file, $rev) = ($1,$3) if ($file =~ /(.*),(-r)?([\d\.]+|[-a-zA-Z\d]+)$/);
+ $cmd = "co -p";
+ $rev = "-r $rev" if ($rev);
+ system("cvs $cmd $rev $file");
+}
diff -r 6489c894dc92 -r cafa42a100cd sbin/mount_portal/examples/overview
--- a/sbin/mount_portal/examples/overview Thu Oct 11 18:02:28 2001 +0000
+++ b/sbin/mount_portal/examples/overview Thu Oct 11 18:41:11 2001 +0000
@@ -1,4 +1,4 @@
-$NetBSD: overview,v 1.1 1999/08/16 06:42:48 bgrayson Exp $
+$NetBSD: overview,v 1.2 2001/10/11 18:41:12 atatat Exp $
Overall notes:
@@ -26,6 +26,8 @@
rfilter.1 Simple rfilter usage: bunzip2/bzcat
rfilter.2 Advanced rfilter usage
advanced.1 A tutorial
+ cvs.1 How to map a cvs server into your local file system
+ cvs.pl A perl script that does the work for the cvs configuration
In progress:
wfilter.1 Simple wfilter usage: bzip2
Home |
Main Index |
Thread Index |
Old Index