On Thu, Dec 11, 2008 at 02:41:46PM -0500, Bailo, John wrote:

> Is Postfix available for or part of Sun's Solaris 10 OS as a compiled
> package?

Build Postfix from source, and then create a package out of that.

Attached a script I used to use to build the "prototype" and "pkginfo" files
for an SvR4 package. The "prototype" is sent to stdout. Then just
"pkgmk" and there you are.

Have not used in a long time, so it may require a bit of tweaking...
And you may need to add an init.d start script in some cases.

-- 
        Viktor.

Disclaimer: off-list followups get on-list replies or get ignored.
Please do not ignore the "Reply-To" header.

To unsubscribe from the postfix-users list, visit
http://www.postfix.org/lists.html or click the link below:
<mailto:majord...@postfix.org?body=unsubscribe%20postfix-users>

If my response solves your problem, the best way to thank me is to not
send an "it worked, thanks" follow-up. If you must respond, please put
"It worked, thanks" in the "Subject" so I can delete these quickly.
#! /bin/env perl

use IO::File;

my $prefix=shift(@ARGV);
# Commands in $INSTALL_EXEC_PREFIX/sbin
# Daemons in $INSTALL_EXEC_PREFIX/libexec
# Docs in $INSTALL_PREFIX/{man,html,readme}
my $INSTALL_EXEC_PREFIX="$prefix";
my $INSTALL_PREFIX="$prefix";
my $CFDIR="/etc/postfix";
my $POSTCONF="$INSTALL_EXEC_PREFIX/sbin/postconf -c $CFDIR";

# Create pkginfo file:
#       ARCH and VERSION are computed dynamically.
#       The Postfix configuration parameters become package parameters,
#       with the first letter converted to upper case.
#
my $info = IO::File->new("pkginfo", "w");
print $info "PKG=postfix\n";
print $info "NAME=Postfix MTA\n";
print $info "ARCH=".qx{uname -p};
print $info "VERSION=".qx{$POSTCONF -d -h mail_version};
print $info "CATEGORY=system\n";
print $info "BASEDIR=/\n";
print $info "DESC=Mail Transport Agent http://www.postfix.org/\n";;
print $info "CLASSES=none site\n";
for (@ARGV) { print $info "\u$1=$3\n"; }

# List pkginfo and the install/remove scripts for "site" files.
#
print "1 i pkginfo\n";
print "1 i postinstall\n";
print "1 i i.site\n";
print "1 i r.site\n";

# These configuration files are preserved if present
#
my %preserve;
for (qw(aliases main.cf master.cf)) { $preserve{$_}=1; }

my $pfiles = "$INSTALL_EXEC_PREFIX/libexec/postfix-files";
my $pfd = IO::File->new($pfiles, "r")
    or die "$0: Could not open: $pfiles: $!\n";

# Parse postfix-files
#
while(defined($_ = <$pfd>) || defined($_ = shift(@extra))) {
    next if (/^#/);
    chomp;
    # Expected format is: name:type:owner:group:permission[:flags]
    #
    my @F=split(/:/, $_);

    # skip obsolete files
    next if ($#F > 4 && $F[5] =~ /o/);

    # Default group for Solaris is "bin"
    #
    $F[3] = "bin" if ($F[3] eq "" || $F[3] eq "-");

    # Compute substituted values for the file locations. 
    #
    (my $path = $F[0]) =~ s{^\$(\w+)}{getconfig($1, 1) || die "$0: $1 not 
known\n"}e;
    (my $owner = $F[2]) =~ s{^\$(\w+)}{getconfig($1, 0) || die "$0: $1 not 
known\n"}e;
    (my $group = $F[3]) =~ s{^\$(\w+)}{getconfig($1, 0) || die "$0: $1 not 
known\n"}e;

    next if ($path =~ m{^no/});

    # Small-caps Postfix installation parameters
    #
    map {s{^\$(\w+)}{\$\u$1}} @F;
    my $dest = $F[0];

    # Check installed image.
    #
    if (!lstat("$path")) {
        # Allow missing directories if automatically created.
        #
        next if ($F[1] eq "d" && $F[5] =~ /c/ || $F[1] eq "l");
        die "$0: $dest missing from image\n";
    }
    if ($F[1] eq "d") {
        # postfix-files wants a directory.
        #
        if ( -d _ ) {
            printf "1 d none %s 0%o %s %s\n",
                $dest, oct($F[4]), $F[2], $F[3];
            next;
        }
        die "$0: $dest is not a directory\n";
    }
    if ($F[1] eq "f") {
        # postfix-files wants a file.
        #
        if ( -f _ ) {
            my $class = "f none";
            if ( $dest =~ m{^\$Config_directory/(.*)}) {
                if (exists $preserve{$1}) {
                    $class = "v site";
                }
            }
            printf "1 %s %s=%s 0%o %s %s\n",
                $class, $dest, $path, oct($F[4]), $F[2], $F[3];
            next;
        }
        die "$0: $dest is not a file\n";
    }
    if ($F[1] eq "l") {
        # postfix-files wants a symlink
        #
        my $link = readlink("$path") or die "$0: readlink($path): $!\n";
        printf "1 s none %s=%s\n", $dest, $link;
    }
    if ($F[1] eq "h") {
        # postfix-files wants a hardlink
        #
        my $link = $F[2];
        printf "1 l none %s=%s\n", $dest, $link;
    }
}
close($pfd);

close($info) or die "$0: pkginfo write error: $!\n";

my %config;
sub getconfig {
    my ($p, $ispath) = @_;

    return $config{$p} if (defined($config{$p}));

    $v = qx{$POSTCONF -d -h $p};
    die "$0: Parameter $p lookup failed\n" if ($? != 0);
    chomp($v);
    return $config{$p}="no" if ($v eq "no");
    die "$0: Parameter $p not an absolute pathname: $v\n"
        if ($ispath && $v !~ m{^/});
    print $info "\u$p=$v\n";

    my $v = qx{$POSTCONF -h $p};
    die "$0: Parameter $p lookup failed\n" if ($? != 0);
    chomp($v);
    return $config{$p} = $v;
}
#

error=no
echo "## Preserving existing site configuration files"
while read src dest
do
    [ "$src" = /dev/null ] && continue
    if [ -f "$dest" ]
    then
        echo $dest preserved
    else
        echo $dest
        cp $src $dest || error=yes
    fi
done
[ "$error" = yes ] && exit 2
exit 0
#

error="no"
echo "## Preserving existing site configuration files"
while read dest
do
    if [ -f "$dest" ]
    then
        echo $dest preserved
    fi
done
[ "$error" = yes ] && exit 2
exit 0

Reply via email to