[openwrt/openwrt] scripts/download.pl: use perl builtins instead of system()
LEDE Commits
lede-commits at lists.infradead.org
Sat Oct 12 13:00:16 PDT 2024
hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/6e40f982082a60b9788cf5e0360142a23180fbfa
commit 6e40f982082a60b9788cf5e0360142a23180fbfa
Author: Matteo Croce <teknoraver at meta.com>
AuthorDate: Sun Sep 29 00:41:23 2024 +0200
scripts/download.pl: use perl builtins instead of system()
Perl natively supports renaming files and create directories.
Do it without calling system().
Signed-off-by: Matteo Croce <teknoraver at meta.com>
Link: https://github.com/openwrt/openwrt/pull/16542
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
scripts/download.pl | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/scripts/download.pl b/scripts/download.pl
index 5449a3406a..c6c9b8e56c 100755
--- a/scripts/download.pl
+++ b/scripts/download.pl
@@ -11,6 +11,7 @@ use strict;
use warnings;
use File::Basename;
use File::Copy;
+use File::Path;
use Text::ParseWords;
use JSON::PP;
@@ -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 |") {
@@ -244,7 +245,7 @@ sub download
};
unlink "$target/$filename";
- system("mv", "$target/$filename.dl", "$target/$filename");
+ move("$target/$filename.dl", "$target/$filename");
cleanup();
}
More information about the lede-commits
mailing list