File: Disable.pm

package info (click to toggle)
extrepo 0.15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 136 kB
  • sloc: perl: 348; sh: 31; makefile: 7
file content (25 lines) | stat: -rw-r--r-- 466 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package Debian::ExtRepo::Commands::Disable;

use v5.28;
use warnings;

use Dpkg::Control::HashCore;

sub run {
	my $config = shift;
	my $mirror = shift;
	my $repo = shift;
	
	my $aptfile = "/etc/apt/sources.list.d/extrepo_$repo.sources";

	if (! -f $aptfile) {
		print "Configuration for $repo does not exist, so not disabled.\n";
		return;
	}
	my $conf = Dpkg::Control::HashCore->new;
	$conf->load($aptfile);
	$conf->{Enabled} = "no";
	$conf->save($aptfile);
}

1;