summaryrefslogtreecommitdiff
path: root/scripts/check-build-env
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/check-build-env')
-rwxr-xr-xscripts/check-build-env49
1 files changed, 23 insertions, 26 deletions
diff --git a/scripts/check-build-env b/scripts/check-build-env
index 6f08847f..6dcf885b 100755
--- a/scripts/check-build-env
+++ b/scripts/check-build-env
@@ -23,34 +23,31 @@
import os
import sys
-required_packages = [
- 'sudo',
- 'make',
- 'live-build',
- 'pbuilder',
- 'devscripts',
- 'python-pystache'
-]
-
-
-def is_installed(name):
- result = os.system("dpkg-query -W --showformat='${{Status}}\n' {name} 2>&1 | grep 'install ok installed' >/dev/null".format(name=name))
- return True if result == 0 else False
-
-
-missing_packages = []
+import util
+
+deps = {
+ 'packages': [
+ 'sudo',
+ 'make',
+ 'live-build',
+ 'pbuilder',
+ 'devscripts',
+ 'python-pystache'
+ ],
+ 'binaries': []
+}
print("Checking if packages required for VyOS image build are installed")
-for p in required_packages:
- if not is_installed(p):
- missing_packages.append(p)
+checker = util.DependencyChecker(deps)
-if missing_packages:
- print("Your system does not have some of the required packages installed.")
- print("Please install the following packages:")
- print(" ".join(missing_packages))
- sys.exit(1)
-else:
- print("All required packages are installed")
+missing = checker.get_missing_dependencies()
+if not missing:
+ print("All dependencies are installed")
sys.exit(0)
+else:
+ checker.print_missing_deps()
+ sys.exit(1)
+
+sys.exit(0)
+