<commit_before># apt-lib.pl
# Functions for installing packages from debian APT

$apt_get_command = $config{'apt_mode'} ? "aptitude" : "apt-get";
$apt_search_command = $config{'apt_mode'} ? "aptitude" : "apt-cache";

# update_system_install([package])
# Install some package with apt
sub update_system_install
{
local (@rv, @newpacks);
local $update = $_[0] || $in{'update'};
print "<b>",&text('apt_install', "<tt>$apt_get_command -y -f install $update</tt>"),"</b><p>\n";
print "<pre>";
$update = join(" ", map { quotemeta($_) } split(/\s+/, $update));
&additional_log('exec', undef, "$apt_get_command -y -f install $update");
&open_execute_command(CMD, "$apt_get_command -y -f install $update 2>&1 </dev/null", 1);
while(<CMD>) {
	if (/setting\s+up\s+(\S+)/i && !/as\s+MDA/i) {
		push(@rv, $1);
		}
	elsif (/packages\s+will\s+be\s+upgraded/i ||
	       /new\s+packages\s+will\s+be\s+installed/i) {
		print;
		$line = $_ = <CMD>;
		$line =~ s/^\s+//; $line =~ s/\s+$//;
		push(@newpacks, split(/\s+/, $line));
		}
	print;
	}
close(CMD);
if (!@rv && $config{'package_system'} ne 'debian' && !$?) {
	# Other systems don't list the packages installed!
	@rv = @newpacks;
	}
print "</pre>\n";
if ($?) { print "<b>$text{'apt_failed'}</b><p>\n"; }
else { print "<b>$text{'apt_ok'}</b><p>\n"; }
return @rv;
}

# update_system_form()
# Shows a form for updating all packages on the system<commit_msg>Force yes response when installing from APT<commit_after># apt-lib.pl
# Functions for installing packages from debian APT

$apt_get_command = $config{'apt_mode'} ? "aptitude" : "apt-get";
$apt_search_command = $config{'apt_mode'} ? "aptitude" : "apt-cache";

# update_system_install([package])
# Install some package with apt
sub update_system_install
{
local (@rv, @newpacks);
local $update = $_[0] || $in{'update'};
print "<b>",&text('apt_install', "<tt>$apt_get_command -y --force-yes -f install $update</tt>"),"</b><p>\n";
print "<pre>";
$update = join(" ", map { quotemeta($_) } split(/\s+/, $update));
&additional_log('exec', undef, "$apt_get_command -y --force-yes -f install $update");
&open_execute_command(CMD, "$apt_get_command -y --force-yes -f install $update 2>&1 </dev/null", 1);
while(<CMD>) {
	if (/setting\s+up\s+(\S+)/i && !/as\s+MDA/i) {
		push(@rv, $1);
		}
	elsif (/packages\s+will\s+be\s+upgraded/i ||
	       /new\s+packages\s+will\s+be\s+installed/i) {
		print;
		$line = $_ = <CMD>;
		$line =~ s/^\s+//; $line =~ s/\s+$//;
		push(@newpacks, split(/\s+/, $line));
		}
	print;
	}
close(CMD);
if (!@rv && $config{'package_system'} ne 'debian' && !$?) {
	# Other systems don't list the packages installed!
	@rv = @newpacks;
	}
print "</pre>\n";
if ($?) { print "<b>$text{'apt_failed'}</b><p>\n"; }
else { print "<b>$text{'apt_ok'}</b><p>\n"; }
return @rv;
}

# update_system_form()
# Shows a form for updating all packages on the system
{'fraction_non_alphanumeric': 0.23824561403508773, 'fraction_numerical': 0.0035087719298245615, 'mean_word_length': 4.535922330097088, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6917450', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1107, 'n_words': 246}