-
Notifications
You must be signed in to change notification settings - Fork 1
/
.travis.bash
executable file
·46 lines (34 loc) · 1.25 KB
/
.travis.bash
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
#!/bin/bash
${TRAVIS_BUILD_DIR:="$PWD"}
# Detect Buildroot release tag.
buildroot-release() {
grep -Pxm1 'FROM\s+[^:]+:\d{4}\.\d\d' "$TRAVIS_BUILD_DIR"/Dockerfile | cut -d: -f2
}
cd ~
# Install dependencies.
apt-get update && DEBIAN_FRONTEND=noninteractive\
apt-get install -y build-essential libncurses5-dev rsync cpio python unzip bc wget
# Install Buildroot.
wget -nv http://buildroot.uclibc.org/downloads/buildroot-$(buildroot-release).tar.bz2 &&\
tar xf buildroot-*.tar* &&\
rm buildroot-*.tar* &&\
ln -s buildroot-* buildroot
# Install toolchain.
wget -nv https://github.com/Docker-nano/crosstool-NG/releases/download/1.0.1/x86_64-nano-linux-uclibc.tar.xz &&\
tar xf *.tar* &&\
ln -s "$(tar tf *.tar* | head -1)" toolchain &&\
rm *.tar*
cd -
# Copy Buildroot resources.
cp -vl in/buildroot.conf ~/buildroot/.config
cp -vla in/rootfs_overlay ~/buildroot
cp -vlr in/patches ~/buildroot
# Configure Buildroot.
cd ~/buildroot
# Create rootfs overlay.
mkdir -vpm775 rootfs_overlay/srv
# Download and configure post-build script.
wget -nv https://raw.githubusercontent.com/Docker-nano/Buildroot/$(buildroot-release)/in/post_build.sh &&\
chmod -v +x post_build.sh
# Apply patches.
(shopt -s nullglob && for patch in patches/*; do patch -p0 -i "$patch"; done)