-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepofy.sh
executable file
·65 lines (49 loc) · 1.65 KB
/
repofy.sh
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
59
60
61
62
63
64
65
#!/usr/bin/env bash
git submodule sync
git submodule update
mkdir -p ./repo/
repo-add -q ./repo/ros.db.tar.xz
repo-add -q ./repo/ros-local.db.tar.xz
if [ ! -d ./chroot/root ]; then
mkdir -p ./.tmp/
cp contrib/pacman.conf .tmp/pacman.conf
echo "[ros-local]
SigLevel = Optional TrustAll
Server = file://$(realpath ./repo)
[ros]
SigLevel = Optional TrustAll
Server = https://repo.aurorafoss.org/ros-archlinux/" >> .tmp/pacman.conf
mkdir -p ./chroot/
mkarchroot -C .tmp/pacman.conf ./chroot/root base-devel
fi
arch-nspawn ./chroot/root --bind-ro="$(realpath ./repo)" pacman -Syu
REPOFY_FOLDERS=$(find ./packages/ -maxdepth 1 -mindepth 1 -type d)
REPOFY_PACKAGES=""
for x in $(find ./repo/ -maxdepth 1 -mindepth 1 -type f | grep '.pkg.tar.xz$'); do
REPOFY_PACKAGES+="$(basename $x)\n"
done
if [ $(printf "$REPOFY_FOLDERS" | wc -l) -gt 0 ]; then
for folder in $REPOFY_FOLDERS; do
pushd $folder
eval "$(cat ./PKGBUILD | sed -e 's/^[ \t]*//' | grep -E "^pkgbase=|^pkgname=|^pkgver=|^pkgrel=" | tr '\n' ';')"
REPOFY_NEEDED="0"
if [ "$1" != "-f" ]; then
for name in $pkgname; do
if [ ! $(printf "$REPOFY_PACKAGES" | grep "^${name}-${pkgver}-${pkgrel}-" | wc -l) -gt 0 ]; then
REPOFY_NEEDED="1"
break
fi
done
fi
if [[ "$1" == "-f" || "$REPOFY_NEEDED" == "1" ]]; then
makechrootpkg -c -r ../../chroot -D "$(realpath ../../repo)" -u
for package in $(find . -maxdepth 1 -mindepth 1 -type f | grep ".pkg.tar.xz$"); do
mv $package ../../repo
repo-add -q ../../repo/ros.db.tar.xz ../../repo/$package
repo-add -q ../../repo/ros-local.db.tar.xz ../../repo/$package
date +%s > ../../repo/lastupdate
done
fi
popd
done
fi