[csw-devel] SF.net SVN: gar:[4552] csw/mgar/pkg

dmichelsen at users.sourceforge.net dmichelsen at users.sourceforge.net
Mon Apr 27 14:54:19 CEST 2009


Revision: 4552
          http://gar.svn.sourceforge.net/gar/?rev=4552&view=rev
Author:   dmichelsen
Date:     2009-04-27 12:54:19 +0000 (Mon, 27 Apr 2009)

Log Message:
-----------
mgetty: Add legacy build description from Michael Gernoth

Added Paths:
-----------
    csw/mgar/pkg/mgetty/
    csw/mgar/pkg/mgetty/trunk/
    csw/mgar/pkg/mgetty/trunk/legacy/
    csw/mgar/pkg/mgetty/trunk/legacy/scripts/
    csw/mgar/pkg/mgetty/trunk/legacy/scripts/analyzer.pl
    csw/mgar/pkg/mgetty/trunk/legacy/scripts/human.pl
    csw/mgar/pkg/mgetty/trunk/legacy/scripts/pkghelper.pl
    csw/mgar/pkg/mgetty/trunk/legacy/sources/
    csw/mgar/pkg/mgetty/trunk/legacy/sources/mgetty-policy.h.patch
    csw/mgar/pkg/mgetty/trunk/legacy/sources/mgetty.postinstall
    csw/mgar/pkg/mgetty/trunk/legacy/specs/
    csw/mgar/pkg/mgetty/trunk/legacy/specs/Makefile
    csw/mgar/pkg/mgetty/trunk/legacy/specs/mgetty

Added: csw/mgar/pkg/mgetty/trunk/legacy/scripts/analyzer.pl
===================================================================
--- csw/mgar/pkg/mgetty/trunk/legacy/scripts/analyzer.pl	                        (rev 0)
+++ csw/mgar/pkg/mgetty/trunk/legacy/scripts/analyzer.pl	2009-04-27 12:54:19 UTC (rev 4552)
@@ -0,0 +1,22 @@
+#!/usr/bin/perl -w
+
+use strict;
+
+my %counter;
+
+while (<>) {
+	if (/\"GET (\/csw\/.*) HTTP\/.\..\"/) {
+		# print "match: $1\n";
+		my $path = $1;
+
+		if ($path =~ /\/csw\/(unstable|stable)\/(sparc|i386)\/5\.(8|9|10)\/([^-]*)-.*\.pkg.gz/) {
+			# print "real match: $1 $2 $3 $4\n";
+			$counter{$4}++;
+		}
+
+	}
+}
+
+foreach my $pkg (reverse(sort {$counter{$a} <=> $counter{$b} or $b cmp $a} (keys(%counter)))) {
+	printf "% 20.20s -> %d\n", $pkg, $counter{$pkg};
+}

Added: csw/mgar/pkg/mgetty/trunk/legacy/scripts/human.pl
===================================================================
--- csw/mgar/pkg/mgetty/trunk/legacy/scripts/human.pl	                        (rev 0)
+++ csw/mgar/pkg/mgetty/trunk/legacy/scripts/human.pl	2009-04-27 12:54:19 UTC (rev 4552)
@@ -0,0 +1,315 @@
+#!/usr/bin/perl -w
+#
+# $Id: human.pl,v 1.1 2004/03/09 10:21:13 simigern Exp $
+#
+# Copyright (c) 2000-2001, Jeremy Mates.  This script is free
+# software; you can redistribute it and/or modify it under the same
+# terms as Perl itself.
+#
+# Run perldoc(1) on this file for additional documentation.
+#
+######################################################################
+#
+# REQUIREMENTS
+
+require 5;
+
+use strict;
+
+######################################################################
+#
+# MODULES
+
+use Carp;			# better error reporting
+use Getopt::Std;		# command line option processing
+
+######################################################################
+#
+# VARIABLES
+
+my $VERSION;
+($VERSION = '$Revision: 1.1 $ ') =~ s/[^0-9.]//g;
+
+my (%opts, $base, $regex);
+
+# various parameters that adjust how the humanization is done
+# these really should be able to be specified on the command line, or
+# read in from a prefs file somewhere, as nobody will agree as to what
+# "proper" human output should look like... :)
+my %format = (
+	     # include decimals in output? (e.g. 25.8 K vs. 26 K)
+	     'decimal' => 1,
+	     # include .0 in decmail output?
+	     'decimal_zero' => 1,
+	     # what to divide file sizes down by
+	     # 1024 is generally "Kilobytes," while 1000 is
+             # "kilobytes," technically
+	     'factor' => 1024,
+	     # percentage above which will be bumped up
+	     # (e.g. 999 bytes -> 1 K as within 5% of 1024)
+	     # set to undef to turn off
+	     'fudge' => 0.95,
+	     # lengths above which decimals will not be included
+	     # for better readability
+	     'max_human_length' => 2,
+	     # list of suffixes for human readable output
+	     'suffix' => [ '', 'K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y' ],
+	     );
+
+# default conversion to do nothing
+$base = 1;
+
+# default to working on runs of 4 or more digits
+$regex = '(?:(?<=\s)|(?<=^))(-?\d{4,})(?:\.\d*){0,1}(?=$|\s)';
+
+######################################################################
+#
+# MAIN
+
+# parse command-line options
+getopts('h?kb:m:', \%opts);
+
+help() if exists $opts{'h'} or exists $opts{'?'};
+
+# set the base conversion factor
+if (exists $opts{'b'}) {
+    ($base) = $opts{'b'} =~ m/(\d+)/;
+    die "Error: base should be a positive integer\n" unless $base;
+}
+
+$base = 1024 if exists $opts{'k'};
+
+# set different regex if requried, add matching parens if none
+# detected in input, as we need to match *something*
+$regex = $opts{'m'} if exists $opts{'m'};
+$regex = '(' . $regex . ')' unless $regex =~ m/\(.+\)/;
+
+while (<STDIN>) {
+    s/$regex/humanize($1)/ego;
+    print;
+}
+
+exit;
+
+######################################################################
+#
+# SUBROUTINES
+
+# Inspired from GNU's df -h output, which fixes 133456345 bytes
+# to be something human readable.
+#
+# takes a number, returns formatted string.
+sub humanize {
+    my $num = shift;
+
+    # error checking on input...
+    return $num unless $num =~ m/^-?\d+$/;
+
+    # some local working variables
+    my $count = 0;
+    my $prefix = '';
+    my $tmp = '';
+    my $orig_len = length $num;
+
+    # handle negatives
+    if ($num < 0 ) {
+	$num = abs $num;
+	$prefix = '-';
+    }
+
+    # adjust number to proper base
+    $num *= $base;
+    
+    # reduce number to something readable by factor specified	
+    while ($num > $format{'factor'}) {
+	$num /= $format{'factor'};
+	$count++;
+    }
+    
+    # optionally fudge "near" values up to next higher level
+    if (defined $format{'fudge'}) {
+	if ($num > ($format{'fudge'} * $format{'factor'})) {
+	    $count++;
+	    $num /= $format{'factor'};
+	}
+    }
+    
+    # no .[1-9] decimal on longer numbers for easier reading
+    # only show decimal if format say so
+    if (length sprintf("%.f", $num) > $format{'max_human_length'} || 
+	! $format{'decimal'}) {
+
+	$tmp = sprintf("%.0f", $num);
+
+    } else {
+	$tmp = sprintf("%.1f", $num);
+	
+	# optionally hack trailing .0 as is not needed
+	$tmp =~ s/\.0$// unless $format{'decimal_zero'};
+    }
+    
+    # return number with proper style applied and leading whitespace
+    # for proper right-justification
+    $tmp = $prefix . $tmp . $format{'suffix'}->[$count];
+    return (' ' x ($orig_len - length $tmp)) . $tmp;
+}
+
+# a generic help blarb
+sub help {
+    print <<"HELP";
+Usage: $0 [opts]
+
+Script to humanize numbers in data.
+
+Options for version $VERSION:
+  -h/-?  Display this message
+
+  -b nn  Integer to offset incoming data by.
+  -k     Default incoming data to Kilobtyes.  Default: bytes.
+
+  -m rr  Regex to match what to operate on.  Default: $regex.
+
+Run perldoc(1) on this script for additional documentation.
+
+HELP
+    exit;
+}
+
+######################################################################
+#
+# DOCUMENTATION
+
+=head1 NAME
+
+human.pl - humanizes file sizes in data
+
+=head1 SYNOPSIS
+
+Make df(1) output readable on systems lacking the human output option:
+
+  $ df -k | human.pl -k
+
+=head1 DESCRIPTION
+
+Intended as a quick way to humanize the output from random programs
+that displays unreadable file sizes, such as df(1) on large file
+systems:
+
+  $ df -k | grep nfs
+  nfs:/mbt    1026892400 704296472 322595928    69%    /mbt
+
+While certain utilities now support humanized output internally, not
+all systems have those utilities.  Hence, this perl script is intended
+to fill that gap util more utilities support humanization routines
+directly.  This will become more important as file systems continue to
+grow, and the exact number of bytes something takes up less meaningful
+to the user.
+
+The data munged by this script is less accurate, in that rounding is
+done in an effort to make the numbers more readable by a human.  In
+the above case, the munged data would look like:
+
+  $ df -k | grep nfs | human.pl -k
+  nfs:/mbt    1.0T 672G 308G    69%    /mbt
+
+=head2 Normal Usage
+
+  $ human.pl [options]
+
+See L<"OPTIONS"> for details on the command line switches supported.
+
+human.pl expects the data to be humanized to come via STDIN, and
+results will be piped to STDOUT.  Input can either be from a program,
+or you can interactively type numbers into the terminal and get a
+humanized size back.
+
+=head1 OPTIONS
+
+This script currently supports the following command line switches:
+
+=over 4
+
+=item B<-h>, B<-?>
+
+Prints a brief usage note about the script.
+
+=item B<-b> I<base>
+
+Optional integer to factor the incoming data by.  The humanizing
+routine operates on bytes by default, so numbers of different formats
+will have to be adjusted accordingly.
+
+The value should be one that adjusts the incoming data to be in bytes
+format; for example, incoming data in Kilobytes would need a base of
+1024 to be converted properly to bytes, as there are 1024 bytes in
+each Kilobyte.
+
+=item B<-k>
+
+Overrides B<-b> and treats the incoming data as if in Kilobytes.
+
+=item B<-m> I<regex>
+
+Optional perl regex to specify what in the incoming data should be
+operated on; the default of digit runs of four or more characters
+should be reasonable in most cases.
+
+Your regex should match integers of some kind; otherwise, the script
+will generally do nothing with your data and not print any warnings.
+If you are matching numbers inside of a more complictated regex, you
+will need to put parentheses around the number you want changed, and
+use non-capturing parentheses for preceeding items, as only $1 is
+passed to the humanizing routine.  See perlre(1) for more details.
+
+If you leave parentheses out of your regex, they will be added around
+it by default.  This lets you supply regex like '\d{7,}' and have it
+work, which is the same as saying '(\d{7,})' in this case.
+
+=back
+
+=head1 BUGS
+
+=head2 Reporting Bugs
+
+Newer versions of this script may be available from:
+
+http://sial.org/code/perl/
+
+If the bug is in the latest version, send a report to the author.
+Patches that fix problems or add new features are welcome.
+
+=head2 Known Issues
+
+No known issues.
+
+=head1 TODO
+
+Option to read humanizing prefs from a external location would be a
+nice idea.
+
+=head1 SEE ALSO
+
+perl(1)
+
+=head1 AUTHOR
+
+Jeremy Mates, http://sial.org/contact/
+
+=head1 COPYRIGHT
+
+Copyright (c) 2000-2001, Jeremy Mates.  This script is free
+software; you can redistribute it and/or modify it under the same
+terms as Perl itself.
+
+=head1 HISTORY
+
+Inspired from the B<-h> option present in GNU df, which is sorely
+lacking in commercial varients of the same name.  (On the other hand,
+leaving the job of humanizing to an external script is probably more
+inline with the unix philosphopy of filters.)
+
+=head1 VERSION
+
+  $Id: human.pl,v 1.1 2004/03/09 10:21:13 simigern Exp $
+
+=cut

Added: csw/mgar/pkg/mgetty/trunk/legacy/scripts/pkghelper.pl
===================================================================
--- csw/mgar/pkg/mgetty/trunk/legacy/scripts/pkghelper.pl	                        (rev 0)
+++ csw/mgar/pkg/mgetty/trunk/legacy/scripts/pkghelper.pl	2009-04-27 12:54:19 UTC (rev 4552)
@@ -0,0 +1,696 @@
+#!/opt/csw/bin/perl -w
+use strict;
+use warnings FATAL => 'uninitialized';
+
+use FindBin qw($RealBin $RealScript);
+use File::Basename;
+use Getopt::Long;
+
+my @csw_ignore = qw(
+opt/csw
+opt/csw/bin
+opt/csw/bin/sparcv8
+opt/csw/bin/sparcv8plus
+opt/csw/bin/sparcv8plus+vis
+opt/csw/bin/sparcv9
+opt/csw/lib
+opt/csw/lib/X11
+opt/csw/lib/X11/app-defaults
+opt/csw/lib/sparcv8plus
+opt/csw/lib/sparcv8plus+vis
+opt/csw/lib/sparcv9
+opt/csw/sbin
+opt/csw/share
+opt/csw/share/doc
+opt/csw/share/info
+opt/csw/share/locale
+opt/csw/share/locale/az
+opt/csw/share/locale/az/LC_MESSAGES
+opt/csw/share/locale/be
+opt/csw/share/locale/be/LC_MESSAGES
+opt/csw/share/locale/bg
+opt/csw/share/locale/bg/LC_MESSAGES
+opt/csw/share/locale/ca
+opt/csw/share/locale/ca/LC_MESSAGES
+opt/csw/share/locale/cs
+opt/csw/share/locale/cs/LC_MESSAGES
+opt/csw/share/locale/da
+opt/csw/share/locale/da/LC_MESSAGES
+opt/csw/share/locale/de
+opt/csw/share/locale/de/LC_MESSAGES
+opt/csw/share/locale/el
+opt/csw/share/locale/el/LC_MESSAGES
+opt/csw/share/locale/en at boldquot
+opt/csw/share/locale/en at boldquot/LC_MESSAGES
+opt/csw/share/locale/en at quot
+opt/csw/share/locale/en at quot/LC_MESSAGES
+opt/csw/share/locale/es
+opt/csw/share/locale/es/LC_MESSAGES
+opt/csw/share/locale/et
+opt/csw/share/locale/et/LC_MESSAGES
+opt/csw/share/locale/eu
+opt/csw/share/locale/eu/LC_MESSAGES
+opt/csw/share/locale/fi
+opt/csw/share/locale/fi/LC_MESSAGES
+opt/csw/share/locale/fr
+opt/csw/share/locale/fr/LC_MESSAGES
+opt/csw/share/locale/ga
+opt/csw/share/locale/ga/LC_MESSAGES
+opt/csw/share/locale/gl
+opt/csw/share/locale/gl/LC_MESSAGES
+opt/csw/share/locale/he
+opt/csw/share/locale/he/LC_MESSAGES
+opt/csw/share/locale/hr
+opt/csw/share/locale/hr/LC_MESSAGES
+opt/csw/share/locale/hu
+opt/csw/share/locale/hu/LC_MESSAGES
+opt/csw/share/locale/id
+opt/csw/share/locale/id/LC_MESSAGES
+opt/csw/share/locale/it
+opt/csw/share/locale/it/LC_MESSAGES
+opt/csw/share/locale/ja
+opt/csw/share/locale/ja/LC_MESSAGES
+opt/csw/share/locale/ko
+opt/csw/share/locale/ko/LC_MESSAGES
+opt/csw/share/locale/locale.alias
+opt/csw/share/locale/lt
+opt/csw/share/locale/lt/LC_MESSAGES
+opt/csw/share/locale/nl
+opt/csw/share/locale/nl/LC_MESSAGES
+opt/csw/share/locale/nn
+opt/csw/share/locale/nn/LC_MESSAGES
+opt/csw/share/locale/no
+opt/csw/share/locale/no/LC_MESSAGES
+opt/csw/share/locale/pl
+opt/csw/share/locale/pl/LC_MESSAGES
+opt/csw/share/locale/pt
+opt/csw/share/locale/pt/LC_MESSAGES
+opt/csw/share/locale/pt_BR
+opt/csw/share/locale/pt_BR/LC_MESSAGES
+opt/csw/share/locale/ro
+opt/csw/share/locale/ro/LC_MESSAGES
+opt/csw/share/locale/ru
+opt/csw/share/locale/ru/LC_MESSAGES
+opt/csw/share/locale/sk
+opt/csw/share/locale/sk/LC_MESSAGES
+opt/csw/share/locale/sl
+opt/csw/share/locale/sl/LC_MESSAGES
+opt/csw/share/locale/sp
+opt/csw/share/locale/sp/LC_MESSAGES
+opt/csw/share/locale/sr
+opt/csw/share/locale/sr/LC_MESSAGES
+opt/csw/share/locale/sv
+opt/csw/share/locale/sv/LC_MESSAGES
+opt/csw/share/locale/tr
+opt/csw/share/locale/tr/LC_MESSAGES
+opt/csw/share/locale/uk
+opt/csw/share/locale/uk/LC_MESSAGES
+opt/csw/share/locale/vi
+opt/csw/share/locale/vi/LC_MESSAGES
+opt/csw/share/locale/wa
+opt/csw/share/locale/wa/LC_MESSAGES
+opt/csw/share/locale/zh
+opt/csw/share/locale/zh/LC_MESSAGES
+opt/csw/share/locale/zh_CN
+opt/csw/share/locale/zh_CN/LC_MESSAGES
+opt/csw/share/locale/zh_CN.GB2312
+opt/csw/share/locale/zh_CN.GB2312/LC_MESSAGES
+opt/csw/share/locale/zh_TW
+opt/csw/share/locale/zh_TW/LC_MESSAGES
+opt/csw/share/locale/zh_TW.Big5
+opt/csw/share/locale/zh_TW.Big5/LC_MESSAGES
+opt/csw/share/man
+);
+
+my @csw_dirs = qw();
+#my @csw_dirs = qw(
+#etc/init.d
+#etc/rc0.d
+#etc/rc1.d
+#etc/rc2.d
+#etc/rc3.d
+#etc/rcS.d
+#opt/csw
+#opt/csw/etc
+#opt/csw/bin
+#opt/csw/bin/sparcv8
+#opt/csw/bin/sparcv8plus
+#opt/csw/bin/sparcv8plus+vis
+#opt/csw/bin/sparcv9
+#opt/csw/sbin
+#opt/csw/share
+#opt/csw/share/doc
+#opt/csw/share/locale
+#opt/csw/share/man
+#opt/csw/share/man/man1
+#opt/csw/share/man/man2
+#opt/csw/share/man/man3
+#opt/csw/share/man/man4
+#opt/csw/share/man/man5
+#opt/csw/share/man/man6
+#opt/csw/share/man/man7
+#opt/csw/share/man/man8
+#opt/csw/share/info
+#opt/csw/lib
+#opt/csw/lib/X11
+#opt/csw/lib/X11/app-defaults
+#opt/csw/include
+#opt/csw/libexec
+#opt/csw/var
+#);
+
+my @possible_scripts = qw(request checkinstall preinstall postinstall preremove postremove);
+
+my @sunwsprolocs = ('/opt/forte11x86/SUNWspro/bin', '/opt/forte11/SUNWspro/bin', '/opt/studio/SOS11/SUNWspro/bin', '/opt/studio/SOS10/SUNWspro/bin', '/opt/forte8/SUNWspro/bin', '/opt/SUNWspro/bin');
+my $builddir     = $ENV{'BUILDDIR'} || '/opt/build/michael';
+my $packagedir   = $ENV{'PACKAGEDIR'} || "${RealBin}/../packages";
+my $content      = "/var/sadm/install/contents";
+my %options; # getopt
+
+# variables defined via eval
+my $progname     = undef;
+my $version      = undef;
+my $buildroot    = undef;
+my $category     = undef;
+my $vendor       = undef;
+my $hotline      = 'http://www.opencsw.org/bugtrack/';
+my $email        = 'michael at opencsw.org';
+my @sources      = undef;
+my $prepatch     = undef;
+my @patches      = (); # default to no patches
+my $copyright    = undef;
+my $build        = undef;
+my $suffix       = undef;
+my $rev          = undef;
+my $arch         = undef;
+my $osversion    = undef;
+my @packages     = undef;
+my @isaexecs     = ();
+my $sunwspropath = undef;
+my %attributes   = ();
+my %seenpaths    = ();
+my %contents     = ();
+
+# helper applications
+my $tar = '/opt/csw/bin/gtar';
+
+sub
+prepare
+{
+	chdir($builddir) || die("can't change to $builddir");
+
+	foreach my $source (@sources) {
+		if      (($source =~ /tar\.gz$/)
+		       ||($source =~ /tgz$/)
+		       ||($source =~ /tar\.Z$/)) {
+			system("/bin/gzcat ${RealBin}/../sources/${source} | ${tar} xf -");
+
+		} elsif ($source =~ /tar\.bz2$/) {
+			system("/bin/bzcat ${RealBin}/../sources/${source} | ${tar} xf -");
+
+		} elsif ($source =~ /tar$/) {
+			system("${tar} xf ${RealBin}/../sources/${source}");
+
+		} else {
+			die("don't know how to extrace ${source}");
+		}
+	}
+
+	if (defined($prepatch)) {
+		open(PREPATCH, "> $builddir/prepatch") || die ("can't create $builddir/prepatch: $!");
+		print PREPATCH $prepatch;
+		close(PREPATCH);
+		system("chmod +x $builddir/prepatch");
+		system("/bin/bash -x $builddir/prepatch");
+		unlink("$builddir/prepatch");
+	}
+
+	foreach my $patch (@patches) {
+		chdir("$builddir/@{$patch}[1]") || die("can't change to $builddir/@{$patch}[1]");
+		system("gpatch @{$patch}[2] < ${RealBin}/../sources/@{$patch}[0]");
+	}
+}
+
+sub probe_directory
+{
+        while (my $dir = shift) {
+                -d $dir && return $dir;
+        }
+
+        return undef;
+}
+
+
+sub
+isaexec
+{
+	foreach my $exec (@isaexecs) {
+		open(ISA, "> ${builddir}/isaexec.c") || die("can't create ${builddir}/isaexec.c for overwrite: $!");
+		print ISA <<"EOF";
+#include <unistd.h>
+
+int
+main(int argc, char *argv[], char *envp[])
+{
+	return (isaexec("${exec}", argv, envp));
+}
+EOF
+		close(ISA);
+		system("${sunwspropath}/cc -o ${buildroot}${exec} ${builddir}/isaexec.c");
+		unlink("${builddir}/isaexec.c");
+	}
+}
+
+sub
+build
+{
+	chdir($builddir) || die("can't change to $builddir");
+
+	open(BUILD, "> $builddir/build") || die ("can't create $builddir/build: $!");
+	print BUILD $build;
+	close(BUILD);
+	system("chmod +x $builddir/build");
+	system("/bin/bash -x $builddir/build");
+	unlink("$builddir/build");
+	isaexec();
+	strip();
+}
+
+sub
+compute_ownership
+{
+	my $path  = shift;
+	my $perm  = shift;
+	my $user  = 'root';
+	my $group = 'bin';
+
+	if (%attributes) {
+		$perm  = $attributes{$path}->{perm}   || $perm;
+		$user  = $attributes{$path}->{user}   || $user;
+		$group = $attributes{$path}->{group} || $group;
+	}
+
+	return "$perm $user $group\n";
+}
+
+# This functions purpose is to get sure that all directories in /path/to/file
+# are also in file list. It also accounts which filename was packaged in what
+# package. So that it possible to warn the user if a file has been packaed in
+# more than one package.
+
+sub
+verify_path
+{
+	my $r = shift;
+	my $prototype = shift;
+	my $path      = shift;
+
+	push(@{$seenpaths{$path}}, "CSW$r->{pkgname}");
+
+	# Handle symlinks in the art of etc/rcS.d/K03cswsamba=../init.d
+	$path =~ s/=.*$//;
+
+	while ('.' ne ($path = dirname($path))) {
+		if (! grep($_ =~ /^d none \/\Q${path}\E\s+/, @$prototype)) {
+			pkgproto($r, $prototype, `echo ${path} | pkgproto`);
+		}
+	}
+}
+
+sub
+pkgproto
+{
+	my $r = shift;
+	my $prototype = shift;
+
+	while (my $line = shift) {
+		my @fields = split(/\s+/, $line);
+		if ($fields[0] eq 'd') {
+			# d none opt/csw 0755 sithglan icipguru
+			if ((! ($fields[2] =~ /\//)) || (grep($fields[2] eq $_, @csw_ignore)) ) {
+				# skip toplevel dirs (opt, etc, ...)
+
+			} elsif (grep($fields[2] eq $_, @csw_dirs)) {
+				unshift(@$prototype, "$fields[0] $fields[1] /$fields[2] ? ? ?\n");
+			} else {
+				unshift(@$prototype, "$fields[0] $fields[1] /$fields[2] " . compute_ownership("/$fields[2]", "$fields[3]"));
+			}
+
+		} elsif ($fields[0] eq 'f') {
+			# f none opt/csw 0755 sithglan icipguru
+			push(@$prototype, "$fields[0] $fields[1] /$fields[2] " . compute_ownership("/$fields[2]", "$fields[3]"));
+			verify_path($r, $prototype, $fields[2]);
+
+		} elsif ( ($fields[0] eq 's')
+			||($fields[0] eq 'l')) {
+			push(@$prototype, "$fields[0] $fields[1] /$fields[2]\n");
+			verify_path($r, $prototype, $fields[2]);
+		} else {
+			die ("unknown line: <$line>");
+		}
+	}
+}
+
+sub
+generate_prototype
+{
+	my $r = shift;
+
+	my @prototype = ();
+
+	chdir($buildroot) || die("can't change to ${buildroot}: $!");
+	push(@prototype, "i pkginfo\n");
+	push(@prototype, "i depend\n");
+	if (defined(${copyright})) {
+		-f "$builddir/${copyright}" || die("can't find copyrightfile: $!");
+		system("cp $builddir/${copyright} copyright");
+		push(@prototype, "i copyright\n");
+	}
+	foreach my $file (@possible_scripts) {
+		if (defined($r->{"$file"})) {
+			-f "${RealBin}/../sources/$r->{$file}" || die("can't find $file: $!");
+			system("cp -f ${RealBin}/../sources/$r->{$file} $file");
+			push(@prototype, "i $file\n");
+		}
+	}
+
+	my @dirs  = `gfind @{$r->{filelist}} -type d | sort | uniq | pkgproto`;
+	pkgproto($r, \@prototype, @dirs);
+	my @links = `gfind @{$r->{filelist}} -type l | sort | uniq | pkgproto`;
+	pkgproto($r, \@prototype, @links);
+	my @files = `gfind @{$r->{filelist}} -type f | sort | uniq | pkgproto`;
+	pkgproto($r, \@prototype, @files);
+
+	open(PROTOTYPE, "> ${buildroot}/prototype") || die("can't open ${buildroot}/prototype for overwrite: $!");
+	print PROTOTYPE @prototype;
+	close(PROTOTYPE);
+}
+
+sub
+uniq
+{
+	my %hash; @hash{@_} = ();
+	return sort keys %hash;
+}
+
+sub
+write_dependencies
+{
+	my $r = shift || die("one reference expected");
+
+	my @out = `pkginfo`;
+	my %pkg = ();
+	foreach my $line (@out) {
+		if ($line =~ /^[^\s]+\s+([^\s]+)\s+([^\s].*)/) {
+			$pkg{$1} = "$2";
+		}
+	}
+
+	open(DEP, '> depend') || die("can't open depend file: $!");
+
+	foreach my $dep (@{$r->{dependencies}}) {
+		if (! defined($pkg{$dep})) {
+			print STDERR "WARNING: FAKEING dependency for <$dep>\n";
+			$pkg{$dep} = 'common - THIS IS A FAKE DEPENDENCY';
+		}
+		print DEP "P $dep $pkg{$dep}\n";
+	}
+
+	if (defined($r->{incompatibilities})) {
+		foreach my $inc (@{$r->{incompatibilities}}) {
+			if (! defined($pkg{$inc})) {
+				print STDERR "WARNING: FAKEING incompatibiltie for <$inc>\n";
+				$pkg{$inc} = 'common - THIS IS A FAKE INCOMPATIBILTY';
+			}
+			print DEP "I $inc $pkg{$inc}\n";
+		}
+	}
+
+	close(DEP);
+}
+
+sub
+resolve_link
+{
+	my $file = shift || die ("one argument expected");
+	my $count = 0;
+
+	chomp($file);
+
+	while ((-l $file)
+	    && ($count < 10)) {
+		my $dirname = dirname($file);
+		$file = readlink($file);
+		if(! ($file =~ /^\//)) {
+			$file = $dirname . '/' . $file;
+		} 
+		$count++;
+	}
+
+	return $file;
+}
+
+sub
+a1minusa2
+{
+	my ($a1,$a2) = @_;
+	my %h;
+	@h{@$a2} = (1) x @$a2;
+	return grep {!exists $h{$_}} @$a1;
+}
+
+sub
+populate_contents
+{
+	open(FILE, ${content}) || die("can't open ${content}: $!");
+	for my $line (<FILE>) {
+		# /etc/cron.d/queuedefs f none 0644 root sys 17 1164 1018133064 SUNWcsr
+		# 0                     1 2    3    4    5   6  7    8          9
+		my @array = split(/\s+/, $line);
+		my ($file, $type, @packages) = @array[0, 1, 9 ... $#array];
+		if ($type =~ /^f$/) {
+			push(@{$contents{$file}}, @packages);
+		}
+	}
+	close(FILE);
+}
+
+sub
+find_dependencies
+{
+	my $r = shift || die("one reference expected");
+	populate_contents();
+
+	chdir(${buildroot}) || die("can't change to ${buildroot}: $!");
+	# look for shared libaries
+	my @deps = `gfind @{$r->{filelist}} \\( -type f -perm +111 \\) -o -path opt/csw/lib/\\*.so\\* | xargs ldd 2> /dev/null | grep -v 'file not found' 2> /dev/null | grep '=>' | awk '{print \$3}'`;
+
+	# look for bangs
+	my @files = `gfind @{$r->{filelist}} -type f -perm +111`;
+	foreach my $file (@possible_scripts) {
+		-f "${buildroot}/${file}" && push(@files, "${buildroot}/${file}");
+	}
+	foreach my $file (@files) {
+		chomp($file);
+		open(FILE, $file) || die("can't open ${file}: $!");
+		my $firstline = <FILE>;
+		if ($firstline =~ /^#!\s?([^\s]+)/) {
+			push(@deps, "$1\n");
+		}
+		close(FILE);
+	}
+	
+	# resolve symlinks / substitute
+	@deps = uniq(@deps);
+	for my $element (@deps) {
+		# /bin and /lib are packages in /usr/{bin,lib}
+		$element =~ s#^/bin#/usr/bin#;
+		$element =~ s#^/lib#/usr/lib#;
+		# /opt/csw/lib/sparcv8 is a symlink to .
+		$element =~ s#^/opt/csw/lib/sparcv8#/opt/csw/lib#;
+		# Resolve links if necessary
+		$element = resolve_link($element);
+	}
+
+	# get dependencies
+	foreach my $dep (@deps) {
+		# </usr/lib/../openwin/lib/libX11.so.4>
+		$dep =~ s#\w+\/\.\.##g;
+
+		if (defined($contents{$dep})) {
+			push(@{$r->{dependencies}}, @{$contents{$dep}});
+		}
+	}
+
+	# make them uniq and don't include a dependency to the packet itself
+	@{$r->{dependencies}} = grep("CSW$r->{pkgname}" ne $_, uniq(@{$r->{dependencies}}));
+
+	if (defined($r->{exclude_dependencies})) {
+		@{$r->{dependencies}} = a1minusa2($r->{dependencies}, $r->{exclude_dependencies});
+	}
+
+	write_dependencies($r);
+}
+
+sub
+strip
+{
+	system("/usr/ccs/bin/strip ${buildroot}/opt/csw/bin/* ${buildroot}/opt/csw/bin/sparcv8/* ${buildroot}/opt/csw/bin/sparcv8plus/* ${buildroot}/opt/csw/bin/sparcv8plus+vis/* ${buildroot}/opt/csw/bin/sparcv9/* 2> /dev/null");
+}
+
+sub
+generate_pkginfo
+{
+	my $r = shift || die("one reference expected");
+
+	chdir(${buildroot}) || die("can't change to ${buildroot}: $!");
+	open(PKGINFO, '> pkginfo');
+
+print PKGINFO <<"EOF";
+PKG=CSW$r->{pkgname}
+NAME=$r->{name}
+ARCH=${arch}
+CATEGORY=${category}
+VERSION=${version}
+VENDOR=${vendor}
+HOTLINE=${hotline}
+EMAIL=${email}
+EOF
+# DESC=[Optional extra info about software. Omit this line if you wish]
+	close(PKGINFO);
+}
+
+sub
+actually_package
+{
+	my $r = shift || die("one reference expected");
+
+	my $filename="$r->{filename}-${version}-SunOS${osversion}-${arch}-CSW.pkg";
+
+	chdir(${buildroot}) || die("can't change to ${buildroot}: $!");
+	system("/usr/bin/pkgmk -o -r ${buildroot}");
+	system("/usr/bin/pkgtrans -s /var/spool/pkg ${packagedir}/$filename CSW$r->{pkgname}");
+	unlink("${packagedir}/${filename}.gz");
+	system("/usr/bin/gzip ${packagedir}/$filename");
+	system("rm -rf /var/spool/pkg/CSW$r->{pkgname}");
+}
+
+# This function makes all files not readable by me readable. This is because
+# the bang checker and pkgmk needs this. The correct permissions are allready
+# in pkginfo file so everything is as it should be.
+
+sub
+make_all_files_readable_by_user
+{ 
+	my $r = shift || die("one reference expected");
+
+	chdir(${buildroot}) || die("can't change to ${buildroot}: $!");
+	system("gfind @{$r->{filelist}} -perm -400 -o -print | xargs -x -n 1 chmod u+r");
+}
+
+sub
+mkpackage
+{
+	foreach my $r (@packages) {
+		generate_prototype($r);
+		make_all_files_readable_by_user($r);
+		generate_pkginfo($r);
+		find_dependencies($r);
+		actually_package($r);
+	}
+
+	foreach my $key (keys(%seenpaths)) {
+		if (1 < @{$seenpaths{$key}}) {
+			print "$key -> @{$seenpaths{$key}}\n";
+		}
+	}
+}
+
+if (! (-d $builddir)) {
+	mkdir("$builddir", 0755) || die("can't create $builddir: $!");
+}
+
+#main
+# {
+
+if (! GetOptions(\%options, "p", "b", "c", "s", "u", "rev=s")) {
+	print <<"__EOF__";
+${RealBin}/${RealScript} [-p] [-b] [-c] [-s] specfile ...
+
+	-p    prepare:  extract and patch sources
+	-b    build:    build and install sources into destenation
+	-c    create:   create package
+	-s    show:     show build script and exit (high precedence!)
+	-u    cleanUp:  remove ${builddir}
+	-rev  <rev>     use <rev> instead of current date
+
+	If no parameter is specified. The given specfile is processed. (eg.
+	prepared, build and packaged)
+__EOF__
+	exit(1);
+}
+
+# Unset makeflags
+$ENV{'MFLAGS'} = '';
+$ENV{'MAKEFLAGS'} = '';
+
+my $infile = shift || die('one argument expected');
+
+if (! defined($arch)) {
+	$arch = `/bin/uname -p` || die("can't get arch: $!");
+	chomp($arch);
+}
+
+$sunwspropath = probe_directory(@sunwsprolocs) || die ("couldn't find SUNWspro");
+
+eval `/bin/cat $infile`;
+
+if (! defined($rev)) {
+	$rev = $options{'rev'} || $ENV{'REV'} || `/bin/date '+20%y.%m.%d'`;
+}
+chomp ($rev);
+
+$version .= ',REV=' . ${rev};
+
+if (defined($suffix)) {
+	$version .= $suffix;
+}
+
+if (! defined($osversion)) {
+	$osversion = `/bin/uname -r`;
+	chomp($osversion);
+}
+
+if (! -d "${packagedir}") {
+	system("/bin/mkdir -p ${packagedir}");
+}
+
+if (! keys(%options)) {
+	prepare();
+	build();
+	mkpackage();
+	exit();
+}
+
+if (defined($options{'s'})) {
+	print $build;
+	exit();
+}
+
+if (defined($options{'p'})) {
+	prepare();
+}
+
+if (defined($options{'b'})) {
+	build();
+}
+
+if (defined($options{'c'})) {
+	mkpackage();
+}
+
+if (defined($options{'u'})) {
+	system("/bin/rm -rf ${builddir}");
+}
+
+# }

Added: csw/mgar/pkg/mgetty/trunk/legacy/sources/mgetty-policy.h.patch
===================================================================
--- csw/mgar/pkg/mgetty/trunk/legacy/sources/mgetty-policy.h.patch	                        (rev 0)
+++ csw/mgar/pkg/mgetty/trunk/legacy/sources/mgetty-policy.h.patch	2009-04-27 12:54:19 UTC (rev 4552)
@@ -0,0 +1,603 @@
+--- /dev/null	2004-04-14 21:21:29.000000000 +0200
++++ policy.h	2004-04-14 21:24:02.851346000 +0200
+@@ -0,0 +1,600 @@
++#ident "$Id: policy.h,v 4.19 2002/12/05 11:52:42 gert Exp $ Copyright (c) Gert Doering"
++
++/* this is the file where all configuration defaults for mgetty / sendfax
++ * are specified.
++ *
++ * defaults are used if no values are given in the config file(s).
++ * config file values can be overridden by command line options.
++ *
++ * see mgetty.texi/mgetty.info for a description of the configuration files.
++ */
++
++/* main mgetty configuration file
++ */
++#define MGETTY_CONFIG "mgetty.config"
++
++/* sendfax configuration file
++ *
++ * if path doesn't start with "/", it's relative to CONFDIR (Makefile)
++ * if not defined, no configuration file is read (saves a few kbytes)
++ */
++#define SENDFAX_CONFIG "sendfax.config"
++
++
++/* login dispatcher config file (for mgetty)
++ *
++ * In this file, you can configure which "login" program (default /bin/login)
++ * to call for what user name.
++ *
++ * You could use it to call "uucico" for all users starting with "U*"
++ * (works only with Taylor UUCP 1.04 with my patch), or to call a fido
++ * mailer for fido calls (only if -DFIDO defined)...
++ * See the samples in the example login.config file (built from login.cfg.in).
++ *
++ * WARNING: make sure that this file isn't world-accessable (SECURITY!)
++ *
++ * If you want to call /bin/login in any case, do not define this
++ *
++ * If this doesn't start with "/", it's relative to CONFDIR.
++ */
++#define LOGIN_CFG_FILE "login.config"
++
++/* default login program
++ *
++ * If LOGIN_CFG_FILE is not defined, or does not exist, or doesn't
++ * have a default entry, this program is called for user logins.
++ * Normally, this is "/bin/login", just a few systems put "login"
++ * elsewhere (e.g. Free/NetBSD in "/usr/bin/login").
++ */
++#define DEFAULT_LOGIN_PROGRAM "/bin/login"
++
++
++/* callback config file
++ *
++ * this file controls the operation of the optional "callback" program.
++ * how callback works, is explained in detail in mgetty.texi. You need
++ * to set LOGIN_CFG_FILE (see above) to use callback from mgetty. 
++ *
++ * If this path does not start with "/", it's relative to CONFDIR.
++ */
++#define CALLBACK_CONFIG "callback.config"
++
++
++/* if this file exists, it can be used to control what callers
++ * are allowed in.  If undefined, the functionality is omitted.
++ * It will work only if your modem supports it. Check the modem manual.
++ * For Rockwell-Based modems, add #CID=1 to MODEM_INIT_STRING, for
++ * ZyXELs use S40.2=1.
++ * If the path doesn't start with "/", it's relative to CONFDIR.
++ */
++#define CNDFILE "dialin.config"
++
++
++/* If you want to use /etc/gettydefs to set tty flags, define this
++ * I recommend against it, I suspect some bugs lingering in that code
++ * (and one doesn't really need it in a normal setup anyway).
++ */
++/* #define USE_GETTYDEFS */
++
++/* Name of the "gettydefs" file (used only if USE_GETTYDEFS is set)
++ */
++#define GETTYDEFS "/etc/gettydefs"
++
++/* If no gettydefs "tag" is specified on the command line, use
++ * this setting (from GETTYDEFS) as default (only if compiled with
++ * USE_GETTYDEFS set)
++ */
++#define GETTYDEFS_DEFAULT_TAG "n"
++
++
++/* access modes */
++
++/* user id of the "uucp" user. The tty device will be owned by this user,
++ * so parallel dial-out of uucico will be possible
++ */
++#define DEVICE_OWNER	"uucp"
++/* group id that the device is chown()ed to. If not defined, the
++ * primary group of "DEVICE_OWNER" is used.
++ */
++#define DEVICE_GROUP	"uucp"
++
++/* access mode for the line while getty has it - it should be accessible
++ * by uucp / uucp, but not by others (imagine someone dialing into your
++ * system and using another modem to dial to another country...)
++ */
++#define FILE_MODE 0660
++
++/* security: optionally, mgetty can system() this, to kill any dangling
++ * processes on the current tty. A %s is replaced with the tty device.
++ * 
++ * Under most circumstances, this is not needed.  You might want
++ * to use it if you offer dial-in services with shell accounts to people
++ * that you don't trust (they might try to abuse your modems, and this
++ * will stop a number of attacks).
++ */
++/* #define EXEC_FUSER "exec fuser -k -f %s >/dev/null 2>&1" */
++
++
++/* logging */
++
++/* system console - if a severe error happens at startup, mgetty writes
++ * a message to this file and aborts
++ * On SCO, this may be /dev/syscon!
++ */
++#define CONSOLE "/dev/console"
++
++/* Name of the mgetty log file
++ * e.g. "/usr/spool/log/mgetty.log.%s" or "/tmp/log_mg.%s"
++ * a "%s" will be replaced by the device name, e.g. "tty2a"
++ *
++ * if the directory does not exist, the log file goes to CONSOLE (!)
++ */
++#define LOG_PATH "/opt/csw/var/log/mgetty.%s"
++
++/* Default log error level threshold. Possible error levels are
++ * L_FATAL, L_ERROR, L_AUDIT, L_WARN, L_MESG, L_NOISE, L_JUNK (see mgetty.h)
++ */
++#define LOG_LEVEL L_MESG
++
++/* Whether "\n"s in the modem response should start a new line
++ * in the logfile
++ */
++/* #define LOG_CR_NEWLINE */
++
++/* System administrator - if a severe error happens (lprintf called
++ * with log_level L_FATAL) and writing to CONSOLE is not possible,
++ * the logfile will be mailed to him
++ */
++#define ADMIN	"root"
++
++/* Syslog
++ *
++ * If you want logging messages of type L_AUDIT, L_ERROR and L_FATAL
++ * to go to the "syslog", define this.
++ * mgetty will use the facility "LOG_AUTH", and the priorities
++ * LOG_NOTICE, LOG_ERR and LOG_ALERT, respectively.
++ */
++/* #define SYSLOG */
++
++/* Syslog facility
++ *
++ * This is the facility mgetty uses for logging. Ususally, this will be
++ * LOG_AUTH, but on some systems, this may not exist, try LOG_DAEMON
++ * instead (or look into the syslog manpage for available options)
++ */
++#define SYSLOG_FC LOG_AUTH
++
++/* login stuff */
++
++/* System name - printed at login prompt
++ * If you do not define this, the uname() call will be used
++ */
++/* #define SYSTEM	"greenie" */
++
++/* Login prompt
++ * The "@", "\\D" and "\\T" escapes will be replaced by SYSTEM, the
++ * current date and time, respectively.
++ * override with "-p <prompt>" switch
++ */
++#define LOGIN_PROMPT	"@!login: "
++
++/* On SVR4, maybe on other systems too, you can cause the 'login' program
++ * to prompt with the same string as mgetty did, instead of the standard
++ * "login:" prompt. The string will be passed to the 'login' program
++ * in the environment variable TTYPROMPT.
++ * This is done by putting "login" into a special (brain-dead) "ttymon"-
++ * compatibility mode. In that mode, mgetty doesn't ask for a login name
++ * at all, so mgetty won't work if you enable that feature and your
++ * login program doesn't support it. (You can see if it doesn't work
++ * if the user gets a double login prompt or none at all).
++ *
++ * This feature automatically disables FIDO and AutoPPP support!
++ *
++ * To use this feature, define ENV_TTYPROMPT.
++ */
++/* #define ENV_TTYPROMPT */
++
++/* Some very old terminals can only generate UPPERCASE letters.
++ * Traditional getty variants detect this, and then set the
++ * corresponding termio(s) flags to convert upper/lower case letters
++ * "on the fly".  Mgetty can do it, but since this is hardly
++ * needed nowadays, the default is off.
++ */
++/* #define DO_LCUC_MAP */
++
++/* Maximum time before login name has to be entered (in seconds)
++ * (after that time a warning will be issued, after that, the call is
++ * dropped). To disable that feature, do not define it.
++ */
++#define MAX_LOGIN_TIME	240
++
++/* nologin file
++ *
++ * If that file exists, a ringing phone won't be answered (see manual).
++ * "%s" will be replaced by the device name.
++ */
++#define NOLOGIN_FILE "/etc/nologin.%s"
++
++
++/* misc */
++
++
++/* Path for the lock files. A %s will be replaced with the device name,
++ * e.g. tty2a -> /usr/spool/uucp/LCK..tty2a
++ * Make sure that this is the same file that your uucico uses for
++ * locking!
++ */
++
++/* for a few systems, you can just take those defaults and be happy */
++#if defined (SVR4) || defined(sunos4)
++# define LOCK_PATH "/var/spool/locks"
++# define LOCK      "/var/spool/locks/LCK..%s"
++#else
++# ifdef sgi
++#  define LOCK	"/usr/spool/locks/LCK..%s"
++# endif
++# ifdef _AIX
++#  define LOCK	"/etc/locks/LCK..%s"
++# endif
++# ifdef NeXT
++#  define LOCK "/usr/spool/uucp/LCK/LCK..%s"
++# endif
++# ifdef linux
++#  define LOCK	"/var/lock/LCK..%s"
++# endif
++# if defined(__FreeBSD__) || defined(__NetBSD__)
++#  define LOCK "/var/spool/lock/LCK..%s"
++# endif 
++#endif
++
++/* if your system isn't listed above, change that line here */
++#ifndef LOCK
++#define LOCK "/usr/spool/uucp/LCK..%s"
++#endif
++  
++/* Set this to "1" if your system uses binary lock files (i.e., the pid
++ * as four byte integer in host byte order written to the lock file)
++ * If it is "0", HDB locking will be used - the PID will be written as
++ * 10 byte ascii, with a trailing newline
++ * (Just check "LOCK" while uucico or pcomm or ... are running to find
++ * out what lock files are used on your system)
++ * On NeXT systems, you must set this to "1".
++ */
++#define LOCKS_BINARY 0
++
++/* Lower case locks - change the last character of the device name
++ *                    to lowercase for locking purposes.
++ *
++ * If you're using a SCO Unix system with those "tty1a/tty1A" device
++ * pairs, you'll have to define this.
++ */
++/* #define LOCKS_LOWERCASE */
++
++/* Change _all_ characters to lowercase (currently no system uses this) */
++/* #define LOCKS_ALL_LOWERCASE */
++
++
++/* the default speed used by mgetty - override it with "-s <speed>"
++ *
++ * WARNING: this is a bit tricky, since some modems insist on going to
++ * 19200 bps when in fax mode. So, if fax receiving with a port speed of
++ * something else doesn't work, try experimenting with FAX_RECV_SWITCHBD,
++ * and if that doesn't help, try DEFAULT_PORTSPEED 19200
++ *
++ * WARNING2: Speeds higher than 38400 aren't supported on all platforms,
++ * and sometimes you have to use "50" to get 57600 or so!
++ */
++#define DEFAULT_PORTSPEED	38400
++
++/* the modem initialization string
++ *
++ * the default string should set up most hayes compatible modems into a
++ * fairly sane state (echo on, verbose reports on, quiet off, reset on
++ * DTR toggle on), but it doesn't set any flow control options (because
++ * that's done differently on each modem, look into your manual for commands
++ * like &H3, &K4, \Q6 or similar things) or protocols.
++ *
++ * You can change the initialization sequence with the "init-chat" keyword
++ * in "mgetty.config".
++ *
++ * If you need delays, specify them as "\\d", if you want to send a
++ * backslash ('\'), give it as "\\\\".
++ *
++ * Very IMPORTANT: make sure that the modem assigns the DCD line properly,
++ * usually this is done with the AT&C1 command!
++ *
++ * The modem must answer with "OK" (!!!) - otherwise, use "init-chat".
++ */
++#define MODEM_INIT_STRING	"ATS0=0Q0&D3&C1"
++
++/* command termination string
++ *
++ * for most modems, terminating the AT... command with "\r" is
++ * sufficient and "\r\n" also works without doing harm.
++ * Unfortunately, for the Courier HST, you've to use *only* \r,
++ * otherwise ATA won't work (immediate NO CARRIER), and for some
++ * (old) ZyXELs, you have to use \r\n (no OK otherwise).
++ * So, try one, and if it doesn't work, try the other.
++ */
++#define MODEM_CMD_SUFFIX "\r"
++
++/* "keep alive"
++ *
++ * mgetty can periodically check whether the modem is still alive
++ * by issueing an "AT\r" command and checking for the "OK"
++ * Define here, in seconds, how often mgetty should check. For normal
++ * reliable modems, once an hour should be sufficient...
++ * If you use "-1", or don't define this at all, mgetty won't check.
++ */
++#define MODEM_CHECK_TIME 3600
++
++
++/* modem mode
++ *
++ * DEFAULT_MODEMTYPE specifies the default way mgetty+sendfax handle a
++ * faxmodem. You have four choices:
++ *   "data" - data only, no faxing available (for sendfax, equal to "auto")
++ *   "cls2" - use AT+FCLASS=2
++ *   "c2.0" - use AT+FCLASS=2.0
++ *   "auto" - try "2.0", then "2", then fall to "data".
++ *
++ * Normally, you can leave this to "auto", but if you have a modem that
++ * can do class 2.0 and class 2, and 2.0 doesn't work, then you could try
++ * setting it to "cls2".
++ * You can override this define with the "-C <mode>" switch.
++ */
++#define DEFAULT_MODEMTYPE "auto"
++
++
++/* some modems are a little bit slow - after sending a response (OK)
++ * to the host, it will take some time before they can accept the next
++ * command - specify the amount needed in data mode here (in
++ * milliseconds). Normally, 50 ms should be sufficient. (On a slow
++ * machine it may even work without any delay at all)
++ *
++ * Be warned: if your machine isn't able to sleep for less than one
++ * second, this may cause problems.
++ */
++#define DO_CHAT_SEND_DELAY 50
++ /* and this is the delay before sending each command while in fax mode
++  */
++#define FAX_COMMAND_DELAY 50
++
++/* incoming faxes will be chown()ed to this uid and gid.
++ * if FAX_IN_GROUP is undefined, the group of ...OWNER is used.
++ */
++#define FAX_IN_OWNER	"uucp"
++/* #define FAX_IN_GROUP	"root" */
++
++/* incoming faxes will be chmod()ed to this mode
++ * (if you do not define this, the file mode will be controlled by
++ * mgetty's umask)
++ */
++#define FAX_FILE_MODE 0660
++
++/* FLOW CONTROL
++ *
++ * There are basically two types of flow control:
++ * - hardware flow control: pull the RTS/CTS lines low to stop the other
++ *   side from spilling out data too fast
++ * - sofware flow control: send an Xoff-Character to tell the other
++ *   side to stop sending, send an Xon to restart
++ * obviously, use of Xon/Xoff has the disadvantage that you cannot send
++ * those characters in your data anymore, but additionally, hardware flow
++ * control is normally faster and more reliable
++ *
++ * mgetty can use multiple flow control variants:
++ * FLOW_NONE  - no flow control at all (absolutely not recommended)
++ * FLOW_HARD  - use RTS/CTS flow control (if available on your machine)
++ * FLOW_SOFT  - use Xon/Xoff flow control, leave HW lines alone
++ * FLOW_BOTH  - use both types simultaneously, if possible
++ *
++ * Note that few operating systems allow both types to be used together.
++ *
++ * mgetty won't (cannot!) notice if your settings don't work, but you'll
++ * see it yourself: you'll experience character losses, garbled faxes,
++ * low data throughput,..., if the flow control settings are wrong
++ *
++ * If in doubt what to use, try both and compare results.
++ * (if you use FAS or SAS with the recommended settings, FLOW_HARD is a
++ * "don't care" since the driver will use RTS/CTS anyway)
++ *
++ * If you use an atypical system, check whether tio_set_flow_control in
++ * tio.c does the right thing for your system.
++ */
++
++/* This is the flow control used for normal data (login) connections
++ * Set it to FLOW_HARD except in very special cases.
++ */
++#define DATA_FLOW	FLOW_HARD
++
++/* This is the flow control used for incoming fax connections
++ * Wrong settings will result in missing lines or erroneous lines
++ * in most of the received faxes.
++ * Most faxmodems expect Xon/Xoff, few honour the RTS line.
++ */
++#define FAXREC_FLOW	FLOW_HARD | FLOW_SOFT
++
++/* And this is for sending faxes
++ *
++ * Wrong settings here will typically result in that the first few
++ * centimeters of a transmitted fax look perfect, and then (the buffer
++ * has filled up), the rest is more or less illegible junk.
++ * For most faxes, this has to be FLOW_SOFT, though the Supra and ZyXEL
++ * modems will (sometimes) do hardware flow control, too. Try it.
++ *
++ * If you see a large number of [11] and [13] characters in the sendfax
++ * log file, your modem is propably doing software flow control - and
++ * you've definitely set FAXSEND_FLOW to FLOW_HARD...
++ *
++ * Some versions of SCO Unix have a "weird" serial driver that will only
++ * do half duplex hardware flow control. You will then run into the problem
++ * that fax sending will time out after the first page sent (no ACK received)
++ * and fail if FLOW_HARD is used. Use FLOW_SOFT instead.
++ */
++#define FAXSEND_FLOW	FLOW_HARD | FLOW_SOFT
++ 
++/* if your faxmodem switches port bit rate just after sending the "+FCON"
++ * message to the host, define this to contain the baudrate used. (Not
++ * important if you have the portspeed set to this value anyway).
++ *
++ * Most Rockwell-based modems need FAX_RECV_SWITCHBD 19200.
++ * ZyXELs do *not* need this, except if explicitely told to do so.
++ *
++ * You can see if this is set wrong if mgetty gets the "+FCON" response,
++ * starts the fax receiver, and times out waiting for OK, receiving
++ * nothing or just junk.
++ */
++/* #define FAX_RECV_SWITCHBD 19200 */
++
++/* some genius at US Robotics obviously decided that the above method
++ * of switching baud rates is broken, and came up with something new
++ * --- broken as well (why bother switching rates at all?) --- this
++ * and other USR Courier Fax follies will be handled by enabling the
++ * following define.
++ *
++ * This should NOT be needed for recent V.34 or ISDN modems anymore
++ * (anything built after 1999).  In doubt, make sure your firmware is
++ * up to date before experimenting with this.
++ */
++/* #define FAX_USRobotics */
++
++/* name of the logfile for outgoing faxes (e.g. /var/log/sendfax.log)
++ *
++ * watch out: if you run 'sendfax' as non-privileged user (user 'fax' etc.)
++ * you might need to create this file manually and chown it to 'fax'
++ */
++#define FAX_LOG		"/opt/csw/var/log/sendfax.log"
++
++/* local station ID (your fax number)
++ * 20 character string, most faxmodem allow all ascii characters 32..127,
++ * but some do only allow digits and blank
++ * AT+FLID=? should tell you what's allowed and what not.
++ */
++#define FAX_STATION_ID	"49 115 xxxxxxxx"
++
++/* ------ sendfax-specific stuff follows here -------- */
++
++/* the baudrate used for *sending* faxes. ZyXELs can handle 38400,
++ * SUPRAs (and many other rockwell-based faxmodems) can not.
++ * I recommend 38400, since 19200 may be to slow for 14400 bps faxmodems!
++ */
++#define FAX_SEND_BAUD 38400
++
++/* switch baud rate after +FCLASS=2
++ *
++ * some weird modems require that you initialize the modem with one
++ * baud rate (e.g. 2400 or 9600 for cheap 2400+fax modems, or `smart'
++ * modems that insist on staying locked to 38400 (ELSA!)), but switch
++ * to another baud rate, typically 19200, immediately after receiving
++ * the "AT+FCLASS=2" command.
++ *
++ * If the following is defined, sendfax will switch to the speed given
++ * here after sending AT+FCLASS=2.
++ *
++ * Only try fiddling with this if sendfax times out during modem
++ * initialization, receiving junk instead of "OK" or "ERROR" (logfile!)
++ */
++/* #define FAX_SEND_SWITCHBD 19200 */
++
++/* this is the command to set the modem to use the desired flow control.
++ * For hardware handshake, this could be AT&H3 for the ZyXEL, &K3 for
++ * Rockwell-Based modems or AT\\Q3&S0 for Exar-Based Modems (i.e. some GVC's)
++ * If you don't want extra initalization, do not define it.
++ * Don't forget the "AT"!
++ */
++/* #define FAX_MODEM_HANDSHAKE "AT&H3" */
++
++/* This is the modem command used for dialing. The phone number will
++ * get appended right after the string. Normally, "ATD" or "ATDP" should
++ * suffice, but in some situations (company telephone systems) you might
++ * need something like "ATx0DT0wP" (switch of dial-tone recognition, tone-
++ * dial a "0", wait for dial-tone, pulse dial the rest)
++ */
++#define FAX_DIAL_PREFIX "ATD"
++
++/* When sending a fax, if the other side says "page bad, retrain
++ * requested", sendfax will retry the page. Specifiy here the maximum
++ * number of retries (I recommend 3) before hanging up.
++ *
++ * If you set it to "0", sendfax will *never* retransmit a page (only
++ * do this if you know that your modem returns +FPTS:2 even if the
++ * page arrived properly, but be warned - you wont' be able to react
++ * properly to transmission errors!)
++ *
++ * See also the description of the "max-tries" and "max-tries-continue"
++ * settings in the sendfax config file.
++ */
++#define FAX_SEND_MAX_TRIES 3
++
++/* the device(s) used for faxing
++ * multiple devices can be separated by ":", e.g. "tty1a:tty2a"
++ * (with or without leading /dev/)
++ * If you don't adapt this for your needs, sendfax won't run (you can
++ * set it from the sendfax.config file, though)!
++ */
++#define FAX_MODEM_TTYS	"term/b"
++
++/* Xon or not?
++ *
++ * the first issues of the class 2 drafts required that the program waits
++ * for an Xon character before sending the page data. Later versions
++ * removed that. Sendfax can do both, default is to wait for it.
++ *
++ * If you get an error message "... waiting for XON" when trying to
++ * send a fax, try this one. Some ELSA modems are know to need it.
++ *
++ * ** THIS OPTION IS OBSOLETE **  
++ * ** use "modem-quirks 0x08" in sendfax.config instead **
++ */
++
++
++/* define mailer that accepts destination on command line and mail text
++ * on stdin. For mailers with user friendly interfaces, (such as mail,
++ * mailx, elm), include an appropriate subject line in the command
++ * definition. If using a mail agent (such as sendmail), that reads
++ * mail headers, define NEED_MAIL_HEADERS.
++ */
++#ifdef SVR4
++# define MAILER		"/usr/bin/mailx -s 'Incoming facsimile message'"
++#else
++# ifdef _AIX
++#  define MAILER	"/usr/sbin/sendmail"
++#  define NEED_MAIL_HEADERS
++# endif
++# ifdef M_UNIX		/* SCO */
++#  define MAILER	"/usr/lib/mail/execmail"
++#  define NEED_MAIL_HEADERS
++# endif
++#endif
++
++#ifndef MAILER
++# define MAILER		"/usr/lib/sendmail"
++# define NEED_MAIL_HEADERS
++#endif
++
++/* where to send notify mail about incoming faxes to
++ * (remember to create an mail alias if no such user exists!)
++ */
++#define MAIL_TO		"root"
++
++/* after a fax has arrived, mgetty can call a program for further
++ * processing of this fax.
++ *
++ * (e.g.: printing of the fax, sending as MIME mail, displaying in an X
++ * window (the latter one could be tricky) ...)
++ *
++ * It will be called as:
++ * <program> <result code> "<sender_id>" <#pgs> <pg1> <pg2>...
++ * 
++ * Define the name of this program here
++ * If you don't want this type of service, do not define it at all
++ * Absolute path name has to be used here!
++ */
++#define FAX_NOTIFY_PROGRAM "/usr/local/lib/mgetty+sendfax/new_fax"
++
++/* default minimum space required on spooling partition for receiving a FAX
++ * (in KILObytes)
++ */
++#define	MINFREESPACE 1024
++

Added: csw/mgar/pkg/mgetty/trunk/legacy/sources/mgetty.postinstall
===================================================================
--- csw/mgar/pkg/mgetty/trunk/legacy/sources/mgetty.postinstall	                        (rev 0)
+++ csw/mgar/pkg/mgetty/trunk/legacy/sources/mgetty.postinstall	2009-04-27 12:54:19 UTC (rev 4552)
@@ -0,0 +1,9 @@
+#!/bin/sh
+#$Id: mgetty.postinstall,v 1.1 2004/03/20 17:57:01 simigern Exp $
+
+test -f "${BASEDIR}/opt/csw/etc/mgetty+sendfax/dialin.config" || cp ${BASEDIR}/opt/csw/etc/mgetty+sendfax/dialin.config.CSW ${BASEDIR}/opt/csw/etc/mgetty+sendfax/dialin.config
+test -f "${BASEDIR}/opt/csw/etc/mgetty+sendfax/faxheader" || cp ${BASEDIR}/opt/csw/etc/mgetty+sendfax/faxheader.CSW ${BASEDIR}/opt/csw/etc/mgetty+sendfax/faxheader
+test -f "${BASEDIR}/opt/csw/etc/mgetty+sendfax/faxrunq.config" || cp ${BASEDIR}/opt/csw/etc/mgetty+sendfax/faxrunq.config.CSW ${BASEDIR}/opt/csw/etc/mgetty+sendfax/faxrunq.config
+test -f "${BASEDIR}/opt/csw/etc/mgetty+sendfax/login.config" || cp ${BASEDIR}/opt/csw/etc/mgetty+sendfax/login.config.CSW ${BASEDIR}/opt/csw/etc/mgetty+sendfax/login.config
+test -f "${BASEDIR}/opt/csw/etc/mgetty+sendfax/mgetty.config" || cp ${BASEDIR}/opt/csw/etc/mgetty+sendfax/mgetty.config.CSW ${BASEDIR}/opt/csw/etc/mgetty+sendfax/mgetty.config
+test -f "${BASEDIR}/opt/csw/etc/mgetty+sendfax/sendfax.config" || cp ${BASEDIR}/opt/csw/etc/mgetty+sendfax/sendfax.config.CSW ${BASEDIR}/opt/csw/etc/mgetty+sendfax/sendfax.config

Added: csw/mgar/pkg/mgetty/trunk/legacy/specs/Makefile
===================================================================
--- csw/mgar/pkg/mgetty/trunk/legacy/specs/Makefile	                        (rev 0)
+++ csw/mgar/pkg/mgetty/trunk/legacy/specs/Makefile	2009-04-27 12:54:19 UTC (rev 4552)
@@ -0,0 +1,28 @@
+PACKAGES := $(shell find . -type f | sed "s/^.\///" | grep -v Makefile)
+
+PREPARE  := $(PACKAGES:=.p)
+BUILD    := $(PACKAGES:=.b)
+CREATE   := $(PACKAGES:=.c)
+SHOW     := $(PACKAGES:=.s)
+
+clean: ../scripts/pkghelper.pl
+	@echo Do you really want to do this\? Press Ctrl-C to abort
+	@read LUTZ
+	@../scripts/pkghelper.pl -u
+
+$(PACKAGES): ../scripts/pkghelper.pl
+	@../scripts/pkghelper.pl $@
+
+$(PREPARE): ../scripts/pkghelper.pl
+	@../scripts/pkghelper.pl -p $(subst .p,,$@)
+
+$(BUILD): ../scripts/pkghelper.pl
+	@../scripts/pkghelper.pl -b $(subst .b,,$@)
+
+$(CREATE): ../scripts/pkghelper.pl
+	@../scripts/pkghelper.pl -c $(subst .c,,$@)
+
+$(SHOW): ../scripts/pkghelper.pl
+	@../scripts/pkghelper.pl -s $(subst .s,,$@)
+
+.PHONY: $(PACKAGES)

Added: csw/mgar/pkg/mgetty/trunk/legacy/specs/mgetty
===================================================================
--- csw/mgar/pkg/mgetty/trunk/legacy/specs/mgetty	                        (rev 0)
+++ csw/mgar/pkg/mgetty/trunk/legacy/specs/mgetty	2009-04-27 12:54:19 UTC (rev 4552)
@@ -0,0 +1,70 @@
+# vim: ft=perl
+# $Id: mgetty,v 1.6 2005/06/30 12:11:50 simigern Exp $
+
+$progname  = 'mgetty';
+$version   = '1.1.31';
+
+$buildroot = "${builddir}/${progname}-${version}-buildroot";
+
+$category  = 'application';
+$vendor    = 'http://alpha.greenie.net/mgetty/ packaged for CSW by Michael Gernoth';
+
+ at sources   = ("${progname}${version}-Jul24.tar.gz");
+
+ at patches   = (['mgetty-policy.h.patch',   "${progname}-${version}", '-p0']);
+
+ at packages  = ({
+		pkgname      => $progname,
+		filename     => $progname,
+		name         => "$progname - An intelligent getty with fax and voice modem support",
+		dependencies => ['CSWcommon'],
+		postinstall  => "mgetty.postinstall",
+		filelist     => [qw(opt)]
+		});
+
+$copyright = "${progname}-${version}/frontends/X11/viewfax-2.5/COPYING";
+
+$attributes{'/opt/csw/var/spool/fax'} = ({user => 'uucp'});
+$attributes{'/opt/csw/var/spool/fax/outgoing'} = ({user => 'uucp'});
+$attributes{'/opt/csw/lib/mgetty+sendfax/faxq-helper'} = ({user => 'uucp'});
+
+$build     = <<"EOF";
+export CC=cc
+export CXX=CC
+export PATH="${sunwspropath}:/usr/ccs/bin:/usr/bin:/usr/openwin/bin:/opt/csw/bin"
+if [ "${arch}" = "sparc" ]; then
+	export CFLAGS='-fast -xarch=v8'
+else
+	export CFLAGS='-xO3 -xspace -xarch=386'
+fi
+export CFLAGS="\$CFLAGS -I/opt/csw/include"
+export CPPFLAGS='-I/opt/csw/include'
+export LD_OPTIONS='-R/opt/csw/lib -L/opt/csw/lib'
+cd ${progname}-${version}
+mkdir dummybins
+export PATH="${builddir}/${progname}-${version}/dummybins:\${PATH}"
+ln -s /bin/true dummybins/chown
+gmake CFLAGS='-Dsolaris2' LIBS='-lsocket -lnsl' prefix=/opt/csw spool=/opt/csw/var/spool CC=cc FAX_OUT_USER=uucp MAN1DIR=/opt/csw/share/man/man1 MAN4DIR=/opt/csw/share/man/man4 MAN5DIR=/opt/csw/share/man/man5 MAN8DIR=/opt/csw/share/man/man8 INFODIR=/opt/csw/share/info
+mkdir -p ${buildroot}/opt/csw/var/spool
+mkdir -p ${buildroot}/opt/csw/share
+gmake DESTDIR=${buildroot} prefix=${buildroot}/opt/csw spool=${buildroot}/opt/csw/var/spool INSTALL='/usr/ucb/install -c -o bin -g bin' FAX_OUT_USER=uucp MAN1DIR=${buildroot}/opt/csw/share/man/man1 MAN4DIR=${buildroot}/opt/csw/share/man/man4 MAN5DIR=${buildroot}/opt/csw/share/man/man5 MAN8DIR=${buildroot}/opt/csw/share/man/man8 INFODIR=${buildroot}/opt/csw/share/info install
+rm ${buildroot}/opt/csw/bin/g3topbm
+mv ${buildroot}/opt/csw/etc/mgetty+sendfax/dialin.config ${buildroot}/opt/csw/etc/mgetty+sendfax/dialin.config.CSW
+mv ${buildroot}/opt/csw/etc/mgetty+sendfax/faxheader ${buildroot}/opt/csw/etc/mgetty+sendfax/faxheader.CSW
+mv ${buildroot}/opt/csw/etc/mgetty+sendfax/faxrunq.config ${buildroot}/opt/csw/etc/mgetty+sendfax/faxrunq.config.CSW
+mv ${buildroot}/opt/csw/etc/mgetty+sendfax/login.config ${buildroot}/opt/csw/etc/mgetty+sendfax/login.config.CSW
+mv ${buildroot}/opt/csw/etc/mgetty+sendfax/mgetty.config ${buildroot}/opt/csw/etc/mgetty+sendfax/mgetty.config.CSW
+mv ${buildroot}/opt/csw/etc/mgetty+sendfax/sendfax.config ${buildroot}/opt/csw/etc/mgetty+sendfax/sendfax.config.CSW
+
+mv ${buildroot}/opt/csw/bin/faxq ${buildroot}/opt/csw/bin/faxq-mgetty
+mv ${buildroot}/opt/csw/bin/faxrm ${buildroot}/opt/csw/bin/faxrm-mgetty
+mv ${buildroot}/opt/csw/share/man/man1/faxq.1 ${buildroot}/opt/csw/share/man/man1/faxq-mgetty.1
+mv ${buildroot}/opt/csw/share/man/man1/faxrm.1 ${buildroot}/opt/csw/share/man/man1/faxrm-mgetty.1
+
+
+##vgetty stuff starts here...
+#cd voice
+#gmake CFLAGS='-Dsolaris2' LIBS='-lsocket -lnsl' prefix=/opt/csw spool=/opt/csw/var/spool CC=cc FAX_OUT_USER=uucp MAN1DIR=/opt/csw/share/man/man1 MAN4DIR=/opt/csw/share/man/man4 MAN5DIR=/opt/csw/share/man/man5 MAN8DIR=/opt/csw/share/man/man8 INFODIR=/opt/csw/share/info
+#gmake DESTDIR=${buildroot} CFLAGS='-Dsolaris2' LIBS='-lsocket -lnsl' prefix=${buildroot}/opt/csw spool=${buildroot}/opt/csw/var/spool INSTALL='/usr/ucb/install -c -o bin -g bin' FAX_OUT_USER=uucp MAN1DIR=${buildroot}/opt/csw/share/man/man1 MAN4DIR=${buildroot}/opt/csw/share/man/man4 MAN5DIR=${buildroot}/opt/csw/share/man/man5 MAN8DIR=${buildroot}/opt/csw/share/man/man8 INFODIR=${buildroot}/opt/csw/share/info install
+
+EOF


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the devel mailing list