summaryrefslogtreecommitdiffstats
path: root/scripts/bootstrap/builder.sh
blob: 4ec722f62a7cf4e4a6d6149ce1bac262e61cee34 (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
#! /bin/bash

# ENVIRONMENTAL PARAMETERS
# REBUILD_INTERVAL (days), manual if not specified
# REBUILD_FAILED (days), manual if not specified 

bash /etc/portage/scripts/bootstrap/builder_sync.sh

# This is intended as permanent container
while [ 1 ]; do
    emerge --usepkg --usepkg-exclude "virtual/*" --binpkg-changed-deps=y --buildpkg --keep-going --update --deep --with-bdeps=y --newuse @world
    status=$?

    if [ $status -eq 0 ]; then
        echo "Emerge successful"
        [ -n "$REBUILD_INTERVAL" ] && echo "Rebuild is scheduled in $REBUILD_INTERVAL days"
        bash /etc/portage/scripts/bootstrap/builder_sleep.sh "$REBUILD_INTERVAL"
        bash /etc/portage/scripts/bootstrap/builder_sync.sh
    else
        echo "Emerge crashed with error code: $status"
        [ -n "$REBUILD_FAILED" ] && echo "Automatic rebuild is scheduled in $REBUILD_FAILED days"
        bash /etc/portage/scripts/bootstrap/builder_sleep.sh "$REBUILD_FAILED"
        [ -n "$REBUILD_FAILED" ] && bash /etc/portage/scripts/bootstrap/builder_sync.sh
    fi
done