Skip to content

Commit 46b20d4

Browse files
committed
[add] : Added testpkg
1 parent b265790 commit 46b20d4

1 file changed

Lines changed: 43 additions & 0 deletions

File tree

tools/testpkg.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/usr/bin/env bash
2+
3+
group_list=($(curl -s https://archlinux.org/groups/ | grep "/groups/x86_64" | cut -d "/" -f 4))
4+
5+
function searchpkg(){
6+
if printf "%s\n" "${group_list[@]}" | grep -x "${1}" >/dev/null; then
7+
return 0
8+
fi
9+
#if pacman -Ssq "${1}" 2>/dev/null | grep -o "^${1}*\$" 1>/dev/null; then
10+
if [[ -n "$(curl -sL "https://archlinux.org/packages/search/json/?name=${1}" | jq -r '.results[]')" ]]; then
11+
return 0
12+
elif [[ -n "$(curl -sL "https://archlinux.org/packages/search/json/?q=${1}" | jq -r ".results[].provides[]")" ]]; then
13+
return 0
14+
elif [[ -n "$(curl -s https://repo.dyama.net/alter-stable/x86_64/ | grep '\./' | grep "pkg.tar" | sed "s| ||g" | cut -d '"' -f 2 | xargs -If basename f | grep "${1}")" ]]; then
15+
return 0
16+
else
17+
return 1
18+
fi
19+
}
20+
21+
function trap_exit() {
22+
local status="${?}"
23+
exit "${status}"
24+
}
25+
26+
trap 'trap_exit' 1 2 3 15
27+
28+
script_path="$( cd -P "$( dirname "$(readlink -f "$0")" )" && cd .. && pwd )"
29+
packages="$("${script_path}/tools/allpkglist.sh" -s -a "x86_64")"
30+
error=false
31+
32+
for pkg in ${packages[@]}; do
33+
if ! searchpkg "${pkg}"; then
34+
echo "${pkg} is not in the official repository." >&2
35+
error=true
36+
fi
37+
done
38+
39+
if [[ "${error}" = true ]]; then
40+
exit 1
41+
else
42+
exit 0
43+
fi

0 commit comments

Comments
 (0)