Skip to content

Commit

Permalink
scripts/download.pl: use perl builtins instead of system()
Browse files Browse the repository at this point in the history
Perl natively supports renaming files and create directories.
Do it without calling system().

Signed-off-by: Matteo Croce <teknoraver@meta.com>
Link: openwrt#16542
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  • Loading branch information
teknoraver authored and hauke committed Oct 12, 2024
1 parent a6de2d7 commit 6e40f98
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions scripts/download.pl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use warnings;
use File::Basename;
use File::Copy;
use File::Path;
use Text::ParseWords;
use JSON::PP;

Expand Down Expand Up @@ -173,7 +174,7 @@ sub download
}

if (! -d "$target") {
system("mkdir", "-p", "$target/");
make_path($target);
}

if (! open TMPDLS, "find $mirror -follow -name $filename 2>/dev/null |") {
Expand Down Expand Up @@ -244,7 +245,7 @@ sub download
};

unlink "$target/$filename";
system("mv", "$target/$filename.dl", "$target/$filename");
move("$target/$filename.dl", "$target/$filename");
cleanup();
}

Expand Down

0 comments on commit 6e40f98

Please sign in to comment.