mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-11-01 10:57:47 +00:00
patches: carry forward feed script updates (0002)
Updates the feed management script with TIP-specific modifications. Carried forward from patches/0002. Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
131
patches-24.10/0002-scripts-update-feed-script.patch
Normal file
131
patches-24.10/0002-scripts-update-feed-script.patch
Normal file
@@ -0,0 +1,131 @@
|
||||
From 82e238ffbf14d62ae511c2d66e61a7361b45b75e Mon Sep 17 00:00:00 2001
|
||||
From: John Crispin <john@phrozen.org>
|
||||
Date: Fri, 19 Jun 2020 13:25:27 +0200
|
||||
Subject: [PATCH 02/55] scripts: update feed script
|
||||
|
||||
gen_config.py requires some fixes to the feeds script.
|
||||
|
||||
Signed-off-by: John Crispin <john@phrozen.org>
|
||||
---
|
||||
scripts/feeds | 77 +++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 77 insertions(+)
|
||||
|
||||
diff --git a/scripts/feeds b/scripts/feeds
|
||||
index 959995c7af..dd9ddd7830 100755
|
||||
--- a/scripts/feeds
|
||||
+++ b/scripts/feeds
|
||||
@@ -684,6 +684,35 @@ sub refresh_config {
|
||||
}
|
||||
}
|
||||
|
||||
+sub install_profiles {
|
||||
+ my $feed = shift;
|
||||
+ my $dir = sprintf('feeds/%s/', $feed->[1]);
|
||||
+
|
||||
+ -d "./feeds/profiles" or mkdir "./feeds/profiles" or return 1;
|
||||
+
|
||||
+ opendir (DIR, $dir) or return 0;
|
||||
+ while (my $file = readdir(DIR)) {
|
||||
+ next unless (-f "$dir/$file");
|
||||
+ next unless ($file =~ m/\.profile$/);
|
||||
+ -e "./feeds/profiles/$file" or system("ln -s ../$feed->[1]/$file ./feeds/profiles/");
|
||||
+ }
|
||||
+ closedir(DIR);
|
||||
+}
|
||||
+
|
||||
+sub install_dl {
|
||||
+ my $feed = shift;
|
||||
+ my $dir = sprintf('feeds/%s/dl/', $feed->[1]);
|
||||
+
|
||||
+ -d "./dl" or mkdir "./dl" or return 1;
|
||||
+
|
||||
+ opendir (DIR, $dir) or return 0;
|
||||
+ while (my $file = readdir(DIR)) {
|
||||
+ next unless (-f "$dir/$file");
|
||||
+ -e "./dl/$file" or system("ln -s ../feeds/$feed->[1]/dl/$file ./dl/");
|
||||
+ }
|
||||
+ closedir(DIR);
|
||||
+}
|
||||
+
|
||||
sub install {
|
||||
my $name;
|
||||
my %opts;
|
||||
@@ -716,6 +745,8 @@ sub install {
|
||||
install_src($feed, $name, exists($opts{f})) == 0 or $ret = 1;
|
||||
get_feed($f->[1]);
|
||||
}
|
||||
+ install_profiles($f);
|
||||
+ install_dl($f);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -880,6 +911,47 @@ sub update {
|
||||
return $failed;
|
||||
}
|
||||
|
||||
+sub setup {
|
||||
+ my %opts;
|
||||
+
|
||||
+ getopts('bh', \%opts);
|
||||
+
|
||||
+ if ($opts{h}) {
|
||||
+ usage();
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ if (-e "feeds.conf") {
|
||||
+ warn "The file feeds.conf already exists.\n";
|
||||
+ return 1;
|
||||
+ }
|
||||
+
|
||||
+ open(my $fd, ">>feeds.conf");
|
||||
+
|
||||
+ if ($opts{b}) {
|
||||
+ printf $fd "src-include defaults feeds.conf.default\n";
|
||||
+ }
|
||||
+
|
||||
+ while (my $entry = shift @ARGV) {
|
||||
+ my ($type, $name, $src) = split /,/, $entry;
|
||||
+
|
||||
+ $update_method{$type} or do {
|
||||
+ warn "Unknown type '$type' in parameter $entry\n";
|
||||
+ unlink "feeds.conf";
|
||||
+ return 1;
|
||||
+ };
|
||||
+
|
||||
+ if ($name =~ /[\s-]/) {
|
||||
+ warn "Feed names or sources may not contain whitespace or - characters in parameter $entry\n";
|
||||
+ unlink "feeds.conf";
|
||||
+ return 1;
|
||||
+ }
|
||||
+ printf $fd "%s %s %s\n", $type, $name, $src;
|
||||
+ }
|
||||
+
|
||||
+ return 0;
|
||||
+}
|
||||
+
|
||||
sub feed_config() {
|
||||
foreach my $feed (@feeds) {
|
||||
my $installed = (-f "feeds/$feed->[1].index");
|
||||
@@ -933,6 +1005,10 @@ Commands:
|
||||
-i : Recreate the index only. No feed update from repository is performed.
|
||||
-f : Force updating feeds even if there are changed, uncommitted files.
|
||||
|
||||
+ setup [options] <type,name,link> <type,name,link> ...: generate feeds.conf
|
||||
+ Options:
|
||||
+ -b : Use feeds.conf.default as base for new feeds.conf.
|
||||
+
|
||||
clean: Remove downloaded/generated files.
|
||||
|
||||
EOF
|
||||
@@ -946,6 +1022,7 @@ my %commands = (
|
||||
'search' => \&search,
|
||||
'uninstall' => \&uninstall,
|
||||
'feed_config' => \&feed_config,
|
||||
+ 'setup' => \&setup,
|
||||
'clean' => sub {
|
||||
system("rm -rf ./feeds ./package/feeds ./target/linux/feeds");
|
||||
}
|
||||
--
|
||||
2.34.1
|
||||
|
||||
Reference in New Issue
Block a user