mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-31 02:17:58 +00:00 
			
		
		
		
	patches: restructure patches and backports
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		
							
								
								
									
										131
									
								
								patches/base/0004-scripts-update-feed-script.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								patches/base/0004-scripts-update-feed-script.patch
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,131 @@ | ||||
| From 2abc67a0fbfbf50f4af2baaee07eb10d214973e4 Mon Sep 17 00:00:00 2001 | ||||
| From: John Crispin <john@phrozen.org> | ||||
| Date: Fri, 19 Jun 2020 13:25:27 +0200 | ||||
| Subject: [PATCH 04/43] scripts: update feed script | ||||
|  | ||||
| gen_config.py requires the latest version of 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 eee0a50717..9d66ea5d98 100755 | ||||
| --- a/scripts/feeds | ||||
| +++ b/scripts/feeds | ||||
| @@ -647,6 +647,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; | ||||
| @@ -679,6 +708,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 { | ||||
| @@ -849,6 +880,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"); | ||||
| @@ -900,6 +972,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 | ||||
| @@ -913,6 +989,7 @@ my %commands = ( | ||||
|  	'search' => \&search, | ||||
|  	'uninstall' => \&uninstall, | ||||
|  	'feed_config' => \&feed_config, | ||||
| +	'setup' => \&setup, | ||||
|  	'clean' => sub { | ||||
|  		system("rm -rf ./feeds ./package/feeds"); | ||||
|  	} | ||||
| --  | ||||
| 2.25.1 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 John Crispin
					John Crispin