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. --- Makefile | 5 ++++- scripts/check-deps.sh | 52 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100755 scripts/check-deps.sh diff --git a/Makefile b/Makefile index ddf7c36..67628ad 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,10 @@ KERNEL_VERSION = 5.11.6 BUSYBOX_VERSION = 1.33.0 SYSLINUX_VERSION = 6.03 -all: busybox linux initrd +all: check-deps busybox linux initrd + +check-deps: + scripts/check-deps.sh initrd: @mkdir -p $@ 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