]>
git.proxmox.com Git - proxmox-ve.git/blob - debian/apthook/pve-apt-hook
8 my $fd = $ENV{APT_HOOK_INFO_FD
};
9 my $check_file = '/please-remove-proxmox-ve';
10 my $check_package = 'proxmox-ve';
11 my $hook_name = basename
($0);
15 print "W: ($hook_name) $line";
18 if (!defined $fd || $fd == 0) {
19 $log->("APT_HOOK_INFO_FD not correctly defined, skipping apt-pve-hook checks\n");
23 open(my $fh, "<&=${fd}") or die "E: could not open APT_HOOK_INFO_FD (${fd}) - $!\n";
26 my ($rc, $confirm) = @_;
30 my $line = <STDIN
> if $confirm;
35 chomp (my $ver = <$fh>);
36 if ($ver ne "VERSION 2") {
37 $log->("apt-pve-hook misconfigured, expecting hook protocol version 2\n");
42 while (my $line = <$fh>) {
45 if (!defined($blank)) {
50 my ($pkg, $old, $dir, $new, $action) = (split / /, $line, 5);
51 if (!defined($action)) {
52 $log->("apt-pve-hook encountered unexpected line: $line\n");
56 if ($pkg eq 'proxmox-ve') {
57 if ($action eq '**REMOVE**') {
59 $log->("'$check_file' exists, proceeding with removal of package '${check_package}'\n");
62 $log->("!! WARNING !!\n");
63 $log->("You are attempting to remove the meta-package '${check_package}'!\n");
65 $log->("If you really want to permanently remove '${check_package}' from your system, run the following command\n");
66 $log->("\ttouch '${check_file}'\n");
67 $log->("run apt purge ${check_package} to remove the meta-package\n");
68 $log->("and repeat your apt invocation.\n");
70 $log->("If you are unsure why '$check_package' would be removed, please verify\n");
71 $log->("\t- your APT repository settings\n");
72 $log->("\t- that you are using 'apt full-upgrade' to upgrade your system\n");
75 } elsif ($action eq '**CONFIGURE**' && $dir eq '<' && $old =~ /^6\./ && $new =~ /^7\./) {
76 $log->("!! ATTENTION !!\n");
77 $log->("You are attempting to upgrade from proxmox-ve '$old' to proxmox-ve '$new'. Please make sure to read the Upgrade notes at\n");
78 $log->("\thttps://pve.proxmox.com/wiki/Upgrade_from_6.x_to_7.0\n");
79 $log->("before proceeding with this operation.\n");
81 $log->("Press enter to continue, or C^c to abort.\n");