1

rrclone.pl:

* cr.pl renamed to rrclone.pl
+ added trailing slash check in src. url and dest. path
* added comment about some deps on debian-based distros
This commit is contained in:
eleksir
2017-11-25 00:23:28 +03:00
parent 0fcac86e0f
commit d8a12396ac

View File

@@ -1,6 +1,14 @@
#!/usr/bin/perl
# TODO: implement fool proof paths check (add trailing backslash if it absent on url and path)
#
# simple RPM Repository cloning script
# looks like some toxic ditribution polices for ill-driven distros like debian|ubuntu or less shitty like centos
# make maintainers split std. perl (and python too) distribution to many-many packages, even meta packages like
# perl-modules for ubuntu contain not full set of default perl source distribution' modules, so you have to install
# some packages in order to work with this script
#
# for ubuntu: libjson-pp-perl, libfile-spec-perl, libxml-parser-perl, libio-compress-perl, liburi-perl
# for slackware - everything is bundled with builtin perl :)
use strict;
use warnings "all";
@@ -11,7 +19,7 @@ use File::Spec;
use XML::Parser;
use IO::Zlib;
use URI::URL;
use Data::Dumper;
#use Data::Dumper;
sub dlfunc(@);
sub urlencode($);
@@ -19,6 +27,7 @@ sub getmetadata();
sub help($);
sub path_normalize_by_string_manipulation($);
sub getfilenames($);
sub noslash($);
help(0) unless (defined $ARGV[0]);
help(1) unless (defined $ARGV[1]);
@@ -41,6 +50,9 @@ if ($noclean == 1) {
$BASEDIR = $ARGV[2];
}
noslash($BASEURL);
noslash($BASEDIR);
my @REPOFILES;
my @FILES;
@@ -303,4 +315,11 @@ sub getfilenames($) {
}
sub noslash($) {
my $str = shift;
return if ($str =~ /\/$/);
syswrite STDERR, "Source and destination must have trailing slashes!\n";
exit 1;
}
__END__