archboot/usr/bin/archboot-binary-check.sh

29 lines
918 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2023-08-11 17:19:18 +02:00
# SPDX-License-Identifier: GPL-3.0-or-later
2022-01-28 08:24:31 +01:00
# created by Tobias Powalowski <tpowa@archlinux.org>
2023-09-01 13:28:32 +02:00
. /usr/lib/archboot/common.sh
2023-01-09 18:28:06 +01:00
_usage () {
2024-08-01 13:24:04 +02:00
echo -e "\e[1m\e[36mArchboot\e[m\e[1m - Check On Missing Binaries\e[m"
2024-08-01 10:16:18 +02:00
echo "------------------------------------"
2022-01-28 08:24:31 +01:00
echo "This will check binaries from package, if they exist"
echo "and report missing to binary.log"
2023-04-24 07:02:39 +02:00
echo ""
2024-08-01 19:40:14 +02:00
echo -e "Usage: \e[1m${_BASENAME} <package>\e[m"
2022-01-28 08:24:31 +01:00
exit 0
}
2023-01-09 18:28:06 +01:00
[[ -z "${1}" ]] && _usage
2023-09-01 13:28:32 +02:00
_archboot_check
2022-09-07 09:04:10 +02:00
# update pacman db first
2024-06-10 15:04:08 +02:00
pacman --noconfirm -Sy
2022-09-07 09:04:10 +02:00
if [[ "${1}" == "base" ]]; then
2024-06-10 15:04:08 +02:00
pacman --noconfirm -S base
2024-06-26 14:57:04 +02:00
_PACKAGE="$(LANG=C.UTF-8 pacman -Qi base | rg -o 'Depends.*: (.*)' -r '$1')"
2022-09-07 09:04:10 +02:00
else
2023-01-09 18:28:06 +01:00
_PACKAGE="${1}"
2022-09-07 09:04:10 +02:00
fi
echo "${_PACKAGE}" >binary.log
#shellcheck disable=SC2086
2024-06-26 14:57:04 +02:00
for i in $(pacman -Ql ${_PACKAGE} | rg -o '/usr/bin/..*$'); do
command -v "${i}" &>"${_NO_LOG}" || echo "${i}" >>binary.log
2022-01-28 08:24:31 +01:00
done