From 229435ccf04db72401bb5df7d3b015565952fcc5 Mon Sep 17 00:00:00 2001 From: Mystery Man Date: Wed, 29 Sep 1999 14:13:47 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'V1_0'. --- perl-install/run_program.pm | 55 --------------------------------------------- 1 file changed, 55 deletions(-) delete mode 100644 perl-install/run_program.pm (limited to 'perl-install/run_program.pm') diff --git a/perl-install/run_program.pm b/perl-install/run_program.pm deleted file mode 100644 index 7e91437e7..000000000 --- a/perl-install/run_program.pm +++ /dev/null @@ -1,55 +0,0 @@ -package run_program; - -use diagnostics; -use strict; - -use log; - -1; - -sub run($@) { rooted('', @_) } - -sub rooted { - my ($root, $name, @args) = @_; - my $str = ref $name ? $name->[0] : $name; - log::l("running: $str @args" . ($root ? " with root $root" : "")); - $root ? $root .= '/' : ($root = ''); - - fork and wait, return $? == 0; - { - my ($stdout, $stdoutm, $stderr, $stderrm); - ($stdoutm, $stdout, @args) = @args if $args[0] =~ /^>>?$/; - ($stderrm, $stderr, @args) = @args if $args[0] =~ /^2>>?$/; - - open STDIN, "/dev/null" or die "can't open /dev/null as stdin"; - - if ($stderr) { - $stderrm =~ s/2//; - open STDERR, "$stderrm $root$stderr" or die "run_program can't output in $root$stderr (mode `$stderrm')"; - } else { - open STDERR, ">> /dev/tty7" or open STDERR, ">> /tmp/exec.log" or die "run_program can't log :("; - } - if ($stdout) { - open STDOUT, "$stdoutm $root$stdout" or die "run_program can't output in $root$stdout (mode `$stdoutm')"; - } else { - open STDOUT, ">> /dev/tty7" or open STDOUT, ">> /tmp/exec.log" or die "run_program can't log :("; - } - - $root and chroot $root; - chdir "/"; - - if (ref $name) { - unless (exec { $name->[0] } $name->[1], @args) { - log::l("exec of $name->[0] failed: $!"); - exec('false') or exit(1); - } - } else { - unless (exec $name, @args) { - log::l("exec of $name failed: $!"); - exec('false') or exit(1); - } - - } - } - -} -- cgit v1.2.1