blob: 706365205d9cb44571386d0a2f78698be8e5ba5a (
plain)
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
66
67
68
|
#!/bin/sh
set -e
usage() {
echo "Usage: update-ports [quarterly|custom]"
exit 1
}
[ $# -eq 1 ] || usage
BASEDIR=/usr/ports
REMOTE_QUARTERLY="https://github.com/freebsd/freebsd-ports.git"
REMOTE_CUSTOM="https://github.com/jantuomi/freebsd-ports-custom.git"
case "$1" in
quarterly)
# Find the newest quarterly branch
BRANCH=$(git ls-remote --heads "$REMOTE_QUARTERLY" | grep -oE 'refs/heads/[0-9]{4}Q[0-9]' | sort -t/ -k3 -V | tail -1 | sed 's|refs/heads/||')
if [ -z "$BRANCH" ]; then
echo "Error: Could not determine quarterly branch"
exit 1
fi
# Check if already at this version
VERSION_FILE="${BASEDIR}/quarterly/.version"
if [ -f "$VERSION_FILE" ] && [ "$(cat "$VERSION_FILE")" = "$BRANCH" ]; then
echo "Quarterly ports tree already at $BRANCH."
exit 0
fi
echo "Downloading quarterly ports tree (branch: $BRANCH)..."
TMPDIR="${BASEDIR}/.quarterly.new"
rm -rf "$TMPDIR"
mkdir -p "$TMPDIR"
fetch -qo- "https://github.com/freebsd/freebsd-ports/archive/refs/heads/${BRANCH}.tar.gz" | tar -xf - -C "$TMPDIR" --strip-components=1
echo "$BRANCH" > "$TMPDIR/.version"
if [ -d "${BASEDIR}/quarterly" ]; then
mv "${BASEDIR}/quarterly" "${BASEDIR}/.quarterly.old"
fi
mv "$TMPDIR" "${BASEDIR}/quarterly"
rm -rf "${BASEDIR}/.quarterly.old" &
echo "Done. Quarterly ports tree updated to $BRANCH."
;;
custom)
# Clone or update
if [ -d "${BASEDIR}/custom/.git" ]; then
echo "Updating custom ports overlay..."
git -C "${BASEDIR}/custom" fetch origin
git -C "${BASEDIR}/custom" reset --hard origin/main
else
echo "Cloning custom ports overlay..."
rm -rf "${BASEDIR}/custom"
git clone "$REMOTE_CUSTOM" "${BASEDIR}/custom"
fi
# Regenerate poudriere pkglist from all ports in the overlay
echo "Regenerating poudriere pkglist..."
find "${BASEDIR}/custom" -name Makefile -mindepth 3 -maxdepth 3 | \
sed "s|${BASEDIR}/custom/||; s|/Makefile||" | \
sort > /usr/local/etc/poudriere-pkglist
echo "Pkglist updated: $(wc -l < /usr/local/etc/poudriere-pkglist) ports."
echo "Done. Custom ports overlay updated."
;;
*)
usage
;;
esac
|