summaryrefslogtreecommitdiff
path: root/templates/turris4x.run
blob: 699b1488180718e54708da426107ac80a158f9a8 (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
46
47
48
#!/bin/sh
# vim: ft=sh
set -e
. utils

MAKE="make -j4 IS_TTY=1 BUILD_LOG=1"

echo_stage "Get packages"
git_fetch "https://git.cynerd.cz/openwrt-personal-pkgs" pkgs

echo_stage "Get turris-build"
HASH="$(curl "https://repo.turris.cz/$BOARD-$BRANCH/git-hash" | awk '/ \* turris-build\: /{print $3}')"
HASH="9544f32cf06c29aedf8c3d88b9ff8745179dfa69" # TODO remove this when repo_checkout is integrated
git_fetch "https://gitlab.labs.nic.cz/turris/turris-build.git" turris-build "$HASH"

echo_stage "Prepare SDK"
mkdir openwrt
cd openwrt
echo ../turris-build/compile_fw -t $BOARD -p $BRANCH repo_prepare
GIT_MIRROR="$WORKSPACE/mirror" \
	CCACHE_HOST_DIR="$WORKSPACE/ccache-host" \
	CCACHE_TARGET_DIR="$WORKSPACE/ccache-target" \
	../turris-build/compile_fw -t $BOARD -p $BRANCH repo_prepare

echo_stage "Add our repository as feed"
echo "src-git personal file://$WORKSPACE/pkgs" >> feeds.conf
./scripts/feeds update personal
./scripts/feeds install -p personal -d y -f -a

echo_stage "Compile tools"
$MAKE tools/compile toolchain/compile package/usign/host/compile

echo_stage "Compile packages from our feed"
$MAKE $(./scripts/feeds list -r personal | sed -n 's/^\([^ ]*\).*$/package\/\1\/compile/p' | tr '\n' ' ')

echo_stage "Generate index and sign"
cp ~/openwrt-repo.key key-build
$MAKE -j1 V=99 package/index
rm key-build

echo_stage "Deploy"
ssh upload rm -rf "deploy-turris4x-$BOARD"
scp -r "bin/packages/$ARCH/personal" upload:deploy-turris4x-$BOARD
ssh upload /bin/sh -e <<EOF
	mkdir -p /var/www/repo/turris4x
	rm -rf /var/www/repo/turris4x/$BOARD
	mv deploy-turris4x-$BOARD /var/www/repo/turris4x/$BOARD
EOF