32 lines
1001 B
Bash
32 lines
1001 B
Bash
#!/bin/sh
|
|
# This file is not supposed to be executed directly. It is a common resource file
|
|
# for all pacman functions.
|
|
|
|
# Support: pacman 4.1
|
|
|
|
if ! command -v pacman >/dev/null; then
|
|
echo "You need the pacman package manager."
|
|
exit
|
|
fi
|
|
|
|
if ! command -v makepkg >/dev/null; then
|
|
echo "You need makepkg (the pacman package builder)."
|
|
exit
|
|
fi
|
|
|
|
## We use tzdata as reference for the output fields, because it is almost always
|
|
## installed. This let's us access the entry of pacman's output independently of
|
|
## the current locale.
|
|
pacman_var_list="$(pacman -Qi tzdata | cut -f1 -d':')"
|
|
if [ -z "$pacman_var_list" ]; then
|
|
echo "Could not get pacman's variables."
|
|
exit 2
|
|
fi
|
|
|
|
pacman_name="$(echo "$pacman_var_list" | sed -n '1{p;q}')"
|
|
pacman_deps="$(echo "$pacman_var_list" | sed -n '9{p;q}')"
|
|
pacman_deps_none="$(pacman -Qi tzdata | sed -n '9{s/.*: //;p;q}')"
|
|
pacman_optdeps="$(echo "$pacman_var_list" | sed -n '10{p;q}')"
|
|
pacman_size="$(echo "$pacman_var_list" | sed -n '15{p;q}')"
|
|
|