]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
gcloud: Add function to detect whether we are running on GCP
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 15 Jun 2020 15:07:15 +0000 (15:07 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 19 Jun 2020 17:14:58 +0000 (17:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/general-functions.pl

index 6ddad28d0dbfec849cc66da5c789ed0f080b4170..376b6a09a90af21a3183cd8957c222b77384fb3b 100644 (file)
@@ -1296,4 +1296,12 @@ sub running_on_ec2() {
        return 0;
 }
 
+sub running_on_gcp() {
+       if (-e "/var/run/gcp-instance-id") {
+               return 1;
+       }
+
+       return 0;
+}
+
 1;