]> git.ipfire.org Git - people/ms/pakfire.git/blame - src/scripts/find-prerequires
packager: Package scriptlets
[people/ms/pakfire.git] / src / scripts / find-prerequires
CommitLineData
08e95360 1#!/bin/bash
106d2edd
MT
2###############################################################################
3# #
4# Pakfire - The IPFire package management system #
5# Copyright (C) 2021 Pakfire development team #
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
08e95360 21
106d2edd
MT
22error() {
23 echo "${0#/}: $@" >&2
24}
25
26set -x
27
28main() {
29 local scriptlet="${1}"
30
31 if [ ! -r "${scriptlet}" ]; then
32 error "Input file is not readable"
33 return 1
34 fi
35
36 cat "${scriptlet}" >&2
37
38 # We require a shell
39 echo "/bin/sh"
40
41 local req
42 while read -r req; do
43 case "${req}" in
44 /*)
45 echo "${req}"
46 ;;
47 *)
48 which "${req}"
49 ;;
50 esac
51 done < <(bash --rpm-requires < "${scriptlet}" | sed -e "s/^.*(//;s/)$//" | sort -u)
52
53 return 0
54}
55
56main "$@" || exit $?