From 46b0f9ab44754069f89a66bcd8e253c021ab5f26 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Mon, 15 Jun 2020 15:07:35 +0000 Subject: [PATCH] web: Hide certain menu items when running in cloud environments This used to be only hidden on AWS. Signed-off-by: Michael Tremer --- config/cfgroot/general-functions.pl | 4 ++++ config/cfgroot/header.pl | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/cfgroot/general-functions.pl b/config/cfgroot/general-functions.pl index 376b6a09a9..8ee5eaa5d5 100644 --- a/config/cfgroot/general-functions.pl +++ b/config/cfgroot/general-functions.pl @@ -1288,6 +1288,10 @@ sub formatBytes { # Cloud Stuff +sub running_in_cloud() { + return &running_on_ec2() || &running_on_gcp(); +} + sub running_on_ec2() { if (-e "/var/run/aws-instance-id") { return 1; diff --git a/config/cfgroot/header.pl b/config/cfgroot/header.pl index 8b42bf0233..1046f59921 100644 --- a/config/cfgroot/header.pl +++ b/config/cfgroot/header.pl @@ -170,8 +170,8 @@ sub genmenu { $menu->{'02.status'}{'subMenu'}->{'74.modem-status'}{'enabled'} = 1; } - # Disbale unusable things on EC2 - if (&General::running_on_ec2()) { + # Disbale unusable things in cloud environments + if (&General::running_in_cloud()) { $menu->{'03.network'}{'subMenu'}->{'30.dhcp'}{'enabled'} = 0; $menu->{'03.network'}{'subMenu'}->{'80.macadressmenu'}{'enabled'} = 0; $menu->{'03.network'}{'subMenu'}->{'90.wakeonlan'}{'enabled'} = 0; -- 2.39.5