[pve-devel] [RFC proxmox-ve 3/3] apt hook: disallow major upgrade via virtual console from API/UI

Fabian Ebner f.ebner at proxmox.com
Mon Sep 13 14:04:46 CEST 2021


and adapt the output to avoid too much redundancy.

Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
 debian/apthook/pve-apt-hook | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/debian/apthook/pve-apt-hook b/debian/apthook/pve-apt-hook
index 72a38ca..0eed6eb 100755
--- a/debian/apthook/pve-apt-hook
+++ b/debian/apthook/pve-apt-hook
@@ -77,11 +77,16 @@ while (my $line = <$fh>) {
       $log->("You are attempting to upgrade from proxmox-ve '$old' to proxmox-ve '$new'.\n");
       $log->("Please make sure to read the upgrade notes at\n");
       $log->("\thttps://pve.proxmox.com/wiki/Upgrade_from_6.x_to_7.0\n");
-      $log->("and that you are are connected directly via console or ssh (not the virtual\n");
-      $log->("console offered by the GUI!) before proceeding with this operation.\n");
+      $log->("and that you are are connected directly via console or ssh before proceeding\n");
+      $log->("with this operation.\n");
       $log->("\n");
-      $log->("Press enter to continue, or C^c to abort.\n");
-      $cleanup->(0, 1);
+      if ($ENV{PVE_API_SHELL}) {
+          $log->("Error: Refusing to carry out the major upgrade via GUI/API virtual console.\n");
+          $cleanup->(1);
+      } else {
+          $log->("Press enter to continue, or C^c to abort.\n");
+          $cleanup->(0, 1);
+      }
     }
   }
 }
-- 
2.20.1






More information about the pve-devel mailing list