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

set -Eeuo pipefail

cd /home/build
git clone --depth=3 https://github.com/kunoisayami/repos

pushd repos
git submodule update --init
popd


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.sh' build

    su -e -c './utils/ci-upload.sh' build

else

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

    ./utils/pkgbuild.sh

    ./utils/ci-upload.sh

fi

popd