diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2004-11-01 14:30:01 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2004-11-01 14:30:01 +0000 |
commit | 11958661c8b955ee912f86c21f468e96dec38eeb (patch) | |
tree | 45d5ee1bb2e825d9ad7e2342e4efd3bf293865ee | |
parent | 1039de13029f757ee6b357412bdb28937b5eb8af (diff) |
handle the case of symlinks.
Let pkg_add -r do extraction first, and finish installation later.
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Add.pm | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_add/OpenBSD/Update.pm | 10 | ||||
-rw-r--r-- | usr.sbin/pkg_add/pkg_add | 8 |
3 files changed, 20 insertions, 8 deletions
diff --git a/usr.sbin/pkg_add/OpenBSD/Add.pm b/usr.sbin/pkg_add/OpenBSD/Add.pm index 9985d3ab376..66f4e1902cd 100644 --- a/usr.sbin/pkg_add/OpenBSD/Add.pm +++ b/usr.sbin/pkg_add/OpenBSD/Add.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Add.pm,v 1.2 2004/11/01 11:48:03 espie Exp $ +# $OpenBSD: Add.pm,v 1.3 2004/11/01 14:30:00 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -163,7 +163,13 @@ sub install my $destdir = $state->{destdir}; if (defined $self->{tempname}) { - rename($self->{tempname}, $destdir.$fullname); + if (defined $self->{link}) { + link($destdir.$self->{link}, $destdir.$fullname); + } elsif (defined $self->{symlink}) { + symlink($self->{symlink}, $destdir.$fullname); + } else { + rename($self->{tempname}, $destdir.$fullname); + } } else { my $file=$state->{archive}->next(); if ($file->{name} ne $self->{name}) { diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index d4341e48c27..5ee7859e9e8 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.3 2004/11/01 11:48:03 espie Exp $ +# $OpenBSD: Update.pm,v 1.4 2004/11/01 14:30:00 espie Exp $ # # Copyright (c) 2004 Marc Espie <espie@openbsd.org> # @@ -52,16 +52,16 @@ sub extract } my $destdir = $state->{destdir}; + if (defined $self->{link} || defined $self->{symlink}) { + $self->{tempname} = 1; + return; + } my ($fh, $tempname) = tempfile(DIR => dirname($destdir.$fullname)); print "extracting $tempname\n"; $file->{name} = $tempname; $file->{cwd} = $self->{cwd}; $file->{destdir} = $destdir; - # faked installation are VERY weird - if (defined $self->{symlink} && $state->{do_faked}) { - $file->{linkname} = $destdir.$file->{linkname}; - } $file->create(); $self->{tempname} = $tempname; } diff --git a/usr.sbin/pkg_add/pkg_add b/usr.sbin/pkg_add/pkg_add index 1ccafb5898e..b341103b1b1 100644 --- a/usr.sbin/pkg_add/pkg_add +++ b/usr.sbin/pkg_add/pkg_add @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: pkg_add,v 1.88 2004/11/01 11:27:50 espie Exp $ +# $OpenBSD: pkg_add,v 1.89 2004/11/01 14:30:00 espie Exp $ # # Copyright (c) 2003-2004 Marc Espie <espie@openbsd.org> # @@ -441,6 +441,12 @@ sub really_add($$) $interrupted = 1; }; + if ($state->{replace}) { + require OpenBSD::Update; + + $plist->visit('extract', $state); + } + do_script($plist, REQUIRE, $state, "INSTALL"); do_script($plist, INSTALL, $state, "PRE-INSTALL"); |