=cut
package scripts::functions;
-use File::Copy;
# Export all functions needed to be used by a simple
# perl -Mscripts::functions -e '' script
use Exporter;
open(IN, ". ./config; set |") or die "Could not run shell: $!\n";
while ( my $l = <IN> ) {
chomp ($l);
- if ($l =~ /^([\w\d]+)=(.+)/) {
+ if ($l =~ /^([\w\d]+)='?([^']+)'?/) {
next if ($1 eq 'SHELLOPTS'); # is in read-only
($envar,$enval) = ($1, $2);
$ENV{$envar} = $enval;
sub remote_config
{
open(FP, ">$REMOTE_FILE/bacula-fd.conf") or
- die "ERROR: Can't open $REMOTE_FILE/bacula-fd.conf $?";
+ die "ERROR: Can't open $REMOTE_FILE/bacula-fd.conf $!";
print FP "
Director {
Name = $HOST-dir
close(FP);
chmod 0755, "test.sh";
+ # create a hardlink
+ link("test.sh", "link-test.sh");
+
+ # create long filename
+ mkdir("b" x 255) or print "can't create long dir $!\n";
+ copy("test.sh", ("b" x 255) . '/' . ("a" x 255)) or print "can't create long dir $!\n";
+
+ # play with some symlinks
+ symlink("test.sh", "sym-test.sh");
+ symlink("$REMOTE_FILE/save/test.sh", "sym-abs-test.sh");
+
if ($pid) {
system("ps $pid");
$estat = ($? != 0);