aboutsummaryrefslogtreecommitdiffstats
path: root/roles/jails/20_packager/templates/usr_local_bin_build_packages.sh
blob: b4d5ea619493c56d52c2004484ae5e66710ea96e (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
#!/bin/sh
# Build all ports in /usr/local/my-ports, skip already-built packages.
set -eu

PORTS_DIR="/usr/local/my-ports"
PKG_DIR="/usr/local/packages"

for port_dir in "${PORTS_DIR}"/*/; do
    [ -f "${port_dir}/Makefile" ] || continue

    port_name=$(make -C "${port_dir}" -V PKGNAME)
    pkg_file="${PKG_DIR}/All/${port_name}.pkg"

    if [ -f "${pkg_file}" ]; then
        echo "SKIP ${port_name} (already built)"
        continue
    fi

    echo "BUILD ${port_name}"
    make -C "${port_dir}" clean package PACKAGES="${PKG_DIR}" BATCH=yes
    make -C "${port_dir}" clean
done

# Rebuild the repository catalog
pkg repo "${PKG_DIR}"
echo "Done."