forked from ArchStrike/pkgupdates
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupstream-pkgcheck
More file actions
executable file
·58 lines (49 loc) · 1.46 KB
/
upstream-pkgcheck
File metadata and controls
executable file
·58 lines (49 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env bash
al_repo_list=(core extra community multilib)
as_repo_list=(archstrike archstrike-testing)
arch=x86_64
# Store information about the script and change to the script directory
script_name="${0//*\/}"
script_dir="${0%$script_name}"
if [[ -z "$script_dir" ]]; then
script_dir="$PWD"
else
pushd "$script_dir" >/dev/null
script_dir="$PWD"
popd >/dev/null
fi
cd "$script_dir" || exit
# Read the config
PKGUPDATES_CONFIG=${PKGUPDATES_CONFIG:="$script_dir/pkgupdates.conf"}
source "$PKGUPDATES_CONFIG"
# Update or create the repodir
if [[ -d "$REPODIR" ]]; then
# Setup/update repo
cd "$REPODIR" || exit
# Reset and update the repo
git reset --hard >/dev/null 2>&1
git pull >/dev/null 2>&1
else
# Clone the repo and checkout updates
git clone "$GITREPO_URL" "$REPODIR" >/dev/null 2>&1
fi
# create a temporarily list of all the archlinux packages
for repo in "${al_repo_list[@]}"; do
mirror="http://mirror.rackspace.com/archlinux/$repo/os/$arch"
repo_db="$mirror/$repo.db"
pkglist=$(while read -r; do
pkg="${REPLY/\/*}"
pkg="${pkg%-*}"
pkg="${pkg%-*}"
printf '%s\n' "$pkg"
done < <(curl -s -0 "$repo_db" | tar zt) | sort -u)
done
pushd "$REPODIR" >/dev/null
for repo in "${as_repo_list[@]}"; do
for pkg in ./"$repo"/*; do
pkgname="${pkg/*\/}"
egrep -q '^'"$pkgname"'$' <<< "$pkglist" \
&& printf '%s\n' "$repo/$pkgname"
done
done
popd >/dev/null