aboutsummaryrefslogtreecommitdiff
path: root/docker/dockerbuild.sh
blob: 650c1db2f5dd6218881632ea68fdd7eb09755e10 (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
#!/bin/bash

set -Eeuo pipefail
sudo pacman -Sy

cd /home/build
if [ ! -d repos ] || [ "$(ls -A repos)" ]; then
  git clone --depth=3 https://github.com/kunoisayami/repos


  pushd repos
  git checkout "$CHECKOUT_BRANCH"
  git fetch --recurse-submodules -j2
  git submodule update --init
  popd
fi

export DOCKER_SETUP_SCRIPT=1


if [ $UID -eq 0 ]; then
    chown -R build:build repos

    echo "$TARGET_HOSTS" | base64 -d >> /etc/hosts
else
    echo "$TARGET_HOSTS" | base64 -d | sudo tee -a /etc/hosts >/dev/null
fi

pushd repos
if [ $UID -eq 0 ]; then

    su -c "echo $GPG_PRIV_KEY | base64 -d | gpg --import" build

    su -c './utils/pkgbuild_bootstrap' build

else

    echo $GPG_PRIV_KEY | base64 -d | gpg --import

    ./utils/pkgbuild_bootstrap

fi

popd