diff options
author | Oliver Tappe | 2007-07-28 22:38:11 +0200 |
---|---|---|
committer | Oliver Tappe | 2007-07-28 22:38:11 +0200 |
commit | 102f63c43b0e32622bb5bf83a84cdac67174f539 (patch) | |
tree | ebd5ad2f8c50bca4e8cc38140ae55ee8071bf39c /lib/OpenSLX/Utils.pm | |
parent | * changed several class interfaces as a result of trying to integrate support (diff) | |
download | core-102f63c43b0e32622bb5bf83a84cdac67174f539.tar.gz core-102f63c43b0e32622bb5bf83a84cdac67174f539.tar.xz core-102f63c43b0e32622bb5bf83a84cdac67174f539.zip |
* finished installation support for Debian-etch, Debian-sarge and Ubuntu
are nearly done (Ubuntu still missing a kernel ...)
* some more refactorings to accommodate Debian-support
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1282 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'lib/OpenSLX/Utils.pm')
-rw-r--r-- | lib/OpenSLX/Utils.pm | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/OpenSLX/Utils.pm b/lib/OpenSLX/Utils.pm index bb24f961..bc57078a 100644 --- a/lib/OpenSLX/Utils.pm +++ b/lib/OpenSLX/Utils.pm @@ -25,7 +25,7 @@ $VERSION = 1.01; @EXPORT = qw( copyFile fakeFile linkFile copyBinaryWithRequiredLibs - slurpFile spitFile + slurpFile spitFile appendFile followLink unshiftHereDoc string2Array @@ -125,6 +125,21 @@ sub spitFile return; } +sub appendFile +{ + my $fileName = shift || croak 'need to pass in a fileName!'; + my $content = shift; + + my $fh; + open($fh, '>>', $fileName) + or croak _tr("unable to create file '%s' (%s)\n", $fileName, $!); + print $fh $content + or croak _tr("unable to print to file '%s' (%s)\n", $fileName, $!); + close($fh) + or croak _tr("unable to close file '%s' (%s)\n", $fileName, $!); + return; +} + sub followLink { my $path = shift || croak 'need to pass in a path!'; @@ -171,7 +186,7 @@ sub copyBinaryWithRequiredLibs { foreach my $lib (split "\n", $requiredLibsStr) { my $libDir = dirname($lib); my $targetLib = "$params->{libTargetFolder}$libDir"; -# next if -e $targetLib; + next if -e "$targetLib/$lib"; vlog(3, "copying lib '$lib'"); copyFile($lib, $targetLib); } @@ -182,11 +197,9 @@ sub unshiftHereDoc { my $content = shift; return $content unless $content =~ m{^(\s+)}; - my $shift = length($1); - return - join "\n", - map { substr($_, $shift); } - split m{\n}, $content; + my $shiftStr = $1; + $content =~ s[^$shiftStr][]gms; + return $content; } sub string2Array |