summaryrefslogtreecommitdiff
path: root/Ports/build_installed.sh
blob: 8fbb4851fe2bfb358948c7dfffe632f606dea31f (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
#!/usr/bin/env bash

packagesdb="${SERENITY_BUILD_DIR}/packages.db"

clean=false
case "$1" in
    clean)
        clean=true
        ;;
    *)
        ;;
esac

some_failed=false

while IFS= read -r line; do
    port="$(echo "$line" | cut -d' ' -f2)"
    if [ -d "$port" ]; then
        pushd $port > /dev/null
            dirname=$(basename $port)
            if [ "$clean" == true ]; then
                ./package.sh clean_all
            fi
            if ./package.sh; then
                echo "Built ${dirname}."
            else
                echo "ERROR: Build of ${dirname} was not successful!"
                some_failed=true
            fi
        popd > /dev/null
    else
        echo "ERROR: Previously installed port $port doesn't exist!"
        some_failed=true
    fi
done < <(grep -E "^(auto|manual)" "$packagesdb")

if [ "$some_failed" == false ]; then
    exit 0
else
    exit 1
fi