From 7385ed39a40ca09e66e107b5f47a25d5b0ccbaf7 Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Tue, 23 Jan 2024 11:50:29 +0100 Subject: Add check-deps target in Makefile It's useful to configure the OS before building. --- scripts/check-deps.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100755 scripts/check-deps.sh (limited to 'scripts/check-deps.sh') diff --git a/scripts/check-deps.sh b/scripts/check-deps.sh new file mode 100755 index 0000000..7568e47 --- /dev/null +++ b/scripts/check-deps.sh @@ -0,0 +1,52 @@ +#!/bin/sh + +check_app() +{ + which $1 2>/dev/null 1>/dev/null + local result=$? + + echo -n "Checking $1..." + + if [ $result -gt 0 ]; then + echo 'Not found' + exit 1 + else + echo 'Found' + fi +} + +check_pkg() +{ + $pkg | grep $1 2>/dev/null 1>/dev/null + local result=$? + echo -n "Checking $1..." + + if [ $result -gt 0 ]; then + echo 'Not found' + exit 1 + else + echo 'Found' + fi +} + +fedora() +{ + check_app gcc + check_app make + check_pkg glibc-static +} + +osname=`cat /etc/os-release | grep ^ID= | sed -E 's/.*=(.*)/\1/'` +osver=`cat /etc/os-release | grep ^VERSION_ID= | sed -E 's/.*=(.*)/\1/g'` + +case $osname in + fedora) + pkg="dnf list installed" + fedora + ;; + freebsd) + ;; +esac + +echo +echo 'You can proceed building Alex GNU/Linux' -- cgit v1.2.3