summaryrefslogtreecommitdiff
path: root/bin/maas-version-check
diff options
authorSylvain Pineau <sylvain.pineau@canonical.com>2017-01-30 14:20:46 +0100
committerSylvain Pineau <sylvain.pineau@canonical.com>2017-01-30 14:20:46 +0100
commitec2d0fe7cce712f5c0327240daf545505b37d382 (patch)
treea7eaf82671b1e5ff022aaa4e4c637fede66befb7 /bin/maas-version-check
parent881b957b9bacb10b4ef4108b92853d7e60baa4b2 (diff)
Import plainbox-provider-checkbox_0.34.0~rc1.orig.tar.gzupstream-0.34.0_rc1patched-0.34.0_rc1-1
Diffstat (limited to 'bin/maas-version-check')
-rwxr-xr-xbin/maas-version-check33
1 files changed, 33 insertions, 0 deletions
diff --git a/bin/maas-version-check b/bin/maas-version-check
new file mode 100755
index 0000000..412717d
--- /dev/null
+++ b/bin/maas-version-check
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+# Copyright (C) 2012-2015 Canonical Ltd.
+
+# Authors
+# Jeff Lane <jeff@ubuntu.com>
+
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3,
+# as published by the Free Software Foundation.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+MAAS_FILE="/etc/installed-by-maas"
+MIN_VERSION="2.0"
+
+# Is the file there?
+if [ -s $MAAS_FILE ]; then
+ maas_version=`cat $MAAS_FILE`
+ echo $maas_version
+else
+ echo "ERROR: This system does not appear to have been installed by MAAS"
+ exit 1
+fi
+
+#is the version appropriate
+exit `dpkg --compare-versions $maas_version "ge" $MIN_VERSION`