diff options
author | Rafael Garcia-Suarez <rgarciasuarez@mandriva.com> | 2006-08-01 10:27:16 +0000 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@mandriva.com> | 2006-08-01 10:27:16 +0000 |
commit | c2f1635b6b2c9a524639673e6057eb8bae07c570 (patch) | |
tree | 99c1769073d2ec4485f3dfea9aaea25dcd93cdce /urpm | |
parent | a576b61c4542b4f7f2d826f33baf4de8de935f76 (diff) | |
download | urpmi-c2f1635b6b2c9a524639673e6057eb8bae07c570.tar urpmi-c2f1635b6b2c9a524639673e6057eb8bae07c570.tar.gz urpmi-c2f1635b6b2c9a524639673e6057eb8bae07c570.tar.bz2 urpmi-c2f1635b6b2c9a524639673e6057eb8bae07c570.tar.xz urpmi-c2f1635b6b2c9a524639673e6057eb8bae07c570.zip |
Check that --root directory exists (#24031)
Diffstat (limited to 'urpm')
-rw-r--r-- | urpm/args.pm | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/urpm/args.pm b/urpm/args.pm index 3f2a9a69..b6aa04a6 100644 --- a/urpm/args.pm +++ b/urpm/args.pm @@ -126,7 +126,14 @@ my %options_spec = ( 'norebuild!' => sub { $urpm->{options}{norebuild} = $_[1] }, 'test!' => \$::test, 'skip=s' => \$options{skip}, - 'root=s' => sub { require File::Spec; $::root = File::Spec->rel2abs($_[1]); $::nolock = 1 }, + 'root=s' => sub { + require File::Spec; + $::root = File::Spec->rel2abs($_[1]); + if (!-d $::root) { + $urpm->{fatal}->(9, N("chroot directory doesn't exist")); + } + $::nolock = 1; + }, 'use-distrib=s' => \$::usedistrib, 'excludepath|exclude-path=s' => sub { $urpm->{options}{excludepath} = $_[1] }, 'excludedocs|exclude-docs' => sub { $urpm->{options}{excludedocs} = 1 }, @@ -228,7 +235,14 @@ my %options_spec = ( sources => \$options{sources}, force => \$options{force}, 'skip=s' => \$options{skip}, - 'root=s' => sub { require File::Spec; $options{root} = File::Spec->rel2abs($_[1]); $options{nolock} = 1 }, + 'root=s' => sub { + require File::Spec; + $options{root} = File::Spec->rel2abs($_[1]); + if (!-d $options{root}) { + $urpm->{fatal}->(9, N("chroot directory doesn't exist")); + } + $options{nolock} = 1; + }, 'use-distrib=s' => sub { if ($< != 0) { print STDERR N("You need to be root to use --use-distrib"), "\n"; |