PVE::RPCEnvironment->setup_default_cli_env();
}
+my $new_suite = 'bookworm';
+my $old_suite = 'bullseye';
+my $older_suites = {
+ buster => 1,
+ stretch => 1,
+ jessie => 1,
+};
+
my ($min_pve_major, $min_pve_minor, $min_pve_pkgrel) = (7, 4, 1);
my $ceph_release2code = {
# TODO: check that (original) debian and Proxmox VE mirrors are present.
+ my ($found_suite, $found_suite_where);
+ my ($mismatches, $strange_suites);
+
my $check_file = sub {
my ($file) = @_;
next if $line !~ m/^deb[[:space:]]/; # is case sensitive
my $suite;
-
- # catch any of
- # https://deb.debian.org/debian-security
- # http://security.debian.org/debian-security
- # http://security.debian.org/
- if ($line =~ m|https?://deb\.debian\.org/debian-security/?\s+(\S*)|i) {
- $suite = $1;
- } elsif ($line =~ m|https?://security\.debian\.org(?:.*?)\s+(\S*)|i) {
+ if ($line =~ m|deb\s+\w+://\S+\s+(\S*)|i) {
$suite = $1;
} else {
next;
}
+ my $where = "in ${file}:${number}";
- $found = 1;
+ $suite =~ s/-(?:(?:proposed-)?updates|backports|debug|security)(?:-debug)?$//;
+ if ($suite ne $old_suite && $suite ne $new_suite && !$older_suites->{$suite}) {
+ push $strange_suites->@*, { suite => $suite, where => $where };
+ next;
+ }
- my $where = "in ${file}:${number}";
- # TODO: is this useful (for some other checks)?
+ if (!defined($found_suite)) {
+ $found_suite = $suite;
+ $found_suite_where = $where;
+ } elsif ($suite ne $found_suite) {
+ if (!defined($mismatches)) {
+ $mismatches = [];
+ push $mismatches->@*,
+ { suite => $found_suite, where => $found_suite_where},
+ { suite => $suite, where => $where};
+ } else {
+ push $mismatches->@*, { suite => $suite, where => $where};
+ }
+ }
}
};
PVE::Tools::dir_glob_foreach($dir, '^.*\.list$', $check_file);
- if (!$found) {
- # only warn, it might be defined in a .sources file or in a way not caaught above
- log_warn("No Debian security repository detected in /etc/apt/sources.list and " .
- "/etc/apt/sources.list.d/*.list");
+ if ($strange_suites) {
+ my @strange_list = map { "found suite $_->{suite} at $_->{where}" } $strange_suites->@*;
+ log_notice(
+ "found unusual suites that are neither old '$old_suite' nor new '$new_suite':"
+ ."\n " . join("\n ", @strange_list)
+ ."\n Please ensure these repositories are shipping compatible packages for the upgrade!"
+ );
+ }
+ if (defined($mismatches)) {
+ my @mismatch_list = map { "found suite $_->{suite} at $_->{where}" } $mismatches->@*;
+
+ log_fail(
+ "Found mixed old and new package repository suites, fix before upgrading! Mismatches:"
+ ."\n " . join("\n ", @mismatch_list)
+ ."\n Configure the same base-suite for all Proxmox and Debian provided repos and ask"
+ ." original vendor for any third-party repos."
+ ."\n E.g., for the upgrade to Proxmox VE ".($min_pve_major + 1)." use the '$new_suite' suite."
+ );
+ } elsif (defined($strange_suites)) {
+ log_notice("found no suite mismatches, but found at least one strange suite");
+ } else {
+ log_pass("found no suite mismatch");
}
}