summaryrefslogtreecommitdiff
path: root/usr.sbin/pkg_add/pkg_create
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/pkg_add/pkg_create')
-rw-r--r--usr.sbin/pkg_add/pkg_create24
1 files changed, 12 insertions, 12 deletions
diff --git a/usr.sbin/pkg_add/pkg_create b/usr.sbin/pkg_add/pkg_create
index 6c7bb1eca86..318c625b224 100644
--- a/usr.sbin/pkg_add/pkg_create
+++ b/usr.sbin/pkg_add/pkg_create
@@ -1,6 +1,6 @@
#! /usr/bin/perl
# ex:ts=8 sw=4:
-# $OpenBSD: pkg_create,v 1.33 2005/01/22 12:52:55 espie Exp $
+# $OpenBSD: pkg_create,v 1.34 2005/06/08 09:43:40 espie Exp $
#
# Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org>
#
@@ -228,9 +228,9 @@ sub dosubst
sub copy_subst
{
- my ($srcname, $destname) = @_;
+ my ($srcname, $mode, $destname) = @_;
open my $src, '<', $srcname or die "can't open $srcname";
- open my $dest, '>', $destname or die "can't open $destname";
+ open my $dest, $mode, $destname or die "can't open $destname";
local $_;
while (<$src>) {
print $dest dosubst($_);
@@ -330,11 +330,11 @@ if (!@contents) {
if (defined $opt_c) {
if ($opt_c =~ /^\-/) {
- open(my $fh, '>', $dir.COMMENT) or die "Can't write to COMMENT: $!";
+ open(my $fh, '>', $dir.DESC) or die "Can't write COMMENT to DESC file: $!";
print $fh $';
close($fh);
} else {
- copy_subst($opt_c, $dir.COMMENT);
+ copy_subst($opt_c, '>', $dir.DESC);
}
} else {
Usage "Comment required" unless $regen_package;
@@ -342,11 +342,11 @@ if (defined $opt_c) {
if (defined $opt_d) {
if ($opt_d =~ /^\-/) {
- open(my $fh, '>', $dir.DESC) or die "Can't write to DESC: $!";
+ open(my $fh, '>>', $dir.DESC) or die "Can't write to DESC: $!";
print $fh $';
close($fh);
} else {
- copy_subst($opt_d, $dir.DESC);
+ copy_subst($opt_d, '>>', $dir.DESC);
}
} else {
Usage "Description required" unless $regen_package;
@@ -355,23 +355,23 @@ if (defined $opt_d) {
print "Creating package $ARGV[0]\n" if $opt_v && !$regen_package;
if (defined $opt_i) {
- copy_subst($opt_i, $dir.INSTALL);
+ copy_subst($opt_i, '>', $dir.INSTALL);
}
if (defined $opt_k) {
- copy_subst($opt_k, $dir.DEINSTALL);
+ copy_subst($opt_k, '>', $dir.DEINSTALL);
}
if (defined $opt_r) {
- copy_subst($opt_r, $dir.REQUIRE);
+ copy_subst($opt_r, '>', $dir.REQUIRE);
}
if (defined $opt_M) {
- copy_subst($opt_M, $dir.DISPLAY);
+ copy_subst($opt_M, '>', $dir.DISPLAY);
}
if (defined $opt_U) {
- copy_subst($opt_U, $dir.UNDISPLAY);
+ copy_subst($opt_U, '>', $dir.UNDISPLAY);
}
my @extra_files = ();