Subject: Re: [PATCH v4 0/5] meson: add corresponding target for Makefile's hdr-check

From: Junio C Hamano <[email-masked]>
Date: Tue, 22 Apr 2025 08:55:58 -0700

Phillip Wood <[email-masked]> writes:

> I'd be tempted to check for which package manager to use by using
> `command -v`. That way the only distribution specific knowledge we
> need is the package manager and we don't have to worry about the names
> of the various release files in /etc.
>
> 	if command -v git
> 	then
> 		: nothing to do
> 	elif command -v apk
> 	then
> 		apk add git
> 	elif command -v dnf
> 	then
> 		dnf -y install git
> 	else
> 		apt-get -q -y install git
> 	fi

OK.  "command -v" should be portable enough these days (in the past
people used "type" and yelled at by portability sherriff).  And
having one command line per package manager should be simpler than
having one command line per distro, provided if two distros that
share the same package manager name the "git" package the same way.
We had trouble with "awk" recently ;-)

Curious that we do not check the availability of apt-get here (or
just "apt").

> The commands above omit anything that updates the package cache as we
> do that anyway in install-dependencies.sh and we only really care
> about getting some version of git installed here. It also uses apt-get
> to match what we do in install-dependencies.sh

OK.