diff options
author | Tor Lillqvist <tml@iki.fi> | 2013-05-16 15:29:09 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@iki.fi> | 2013-05-16 16:21:27 +0300 |
commit | 6166282edeb1a5c44d34d4824eab1f82b6e7b15a (patch) | |
tree | c66e7be13c4509219b1b5e9254342b27b77ac68e | |
parent | c2aac3b42e7122569770377091be502939fc9a26 (diff) |
Handle symlinks separately
Change-Id: Ie94a16baaae9d942675d06dda9444b502e6a08dd
-rw-r--r-- | solenv/bin/modules/installer/systemactions.pm | 9 | ||||
-rw-r--r-- | solenv/bin/modules/installer/worker.pm | 13 |
2 files changed, 16 insertions, 6 deletions
diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm index 69aef84ebcd7..ec6313b7ae24 100644 --- a/solenv/bin/modules/installer/systemactions.pm +++ b/solenv/bin/modules/installer/systemactions.pm @@ -292,9 +292,14 @@ sub copy_one_file { my ($source, $dest) = @_; - my ($returnvalue, $infoline); + my ($returnvalue, $infoline, $copyreturn); - my $copyreturn = copy($source, $dest); + if ( -l $source ) { + $copyreturn = symlink(readlink("$source"), "$dest"); + } + else { + $copyreturn = copy($source, $dest); + } if ($copyreturn) { diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index 9a122e46f255..27f00108d6a3 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -373,10 +373,15 @@ sub install_simple ($$$$$$) unlink "$destdir$destination"; } - copy ("$sourcepath", "$destdir$destination") || die "Can't copy file: $sourcepath -> $destdir$destination $!"; - my $sourcestat = stat($sourcepath); - utime ($sourcestat->atime, $sourcestat->mtime, "$destdir$destination"); - chmod (oct($unixrights), "$destdir$destination") || die "Can't change permissions: $!"; + if ( -l "$sourcepath" ) { + symlink (readlink ("$sourcepath"), "$destdir$destination") || die "Can't symlink $destdir$destination -> " . readlink ("$sourcepath") . "$!"; + } + else { + copy ("$sourcepath", "$destdir$destination") || die "Can't copy file: $sourcepath -> $destdir$destination $!"; + my $sourcestat = stat($sourcepath); + utime ($sourcestat->atime, $sourcestat->mtime, "$destdir$destination"); + chmod (oct($unixrights), "$destdir$destination") || die "Can't change permissions: $!"; + } push @lines, "$destination\n"; } |