/
build.sh
executable file
·83 lines (64 loc) · 1.66 KB
/
build.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# (c) 2014-2015 Sam Nazarko
# email@samnazarko.co.uk
#!/bin/bash
. ../common/funcs.sh
wd=$(pwd)
tcstub="amd64-toolchain-osmc"
make clean
check_platform
verify_action
update_sources
verify_action
# Install packages needed to build filesystem for building
packages="debootstrap
dh-make
devscripts"
for package in $packages
do
install_package $package
verify_action
done
# Configure the target directory
ARCH="amd64"
DIR="opt/osmc-tc/${tcstub}"
RLS="jessie"
# Remove existing build
remove_existing_filesystem "{$wd}/{$DIR}"
verify_action
mkdir -p $DIR
# Debootstrap (foreign)
fetch_filesystem "--arch=${ARCH} --foreign --variant=minbase ${RLS} ${DIR}"
verify_action
# Configure filesystem (2nd stage)
configure_filesystem "${DIR}"
verify_action
# Enable networking
enable_nw_chroot "${DIR}"
verify_action
# Set up sources.list
echo "deb http://ftp.debian.org/debian jessie main contrib
deb http://ftp.debian.org/debian/ jessie-updates main contrib
deb http://security.debian.org/ jessie/updates main contrib
deb http://apt.osmc.tv jessie-devel main
" > ${DIR}/etc/apt/sources.list
# Performing chroot operation
chroot ${DIR} mount -t proc proc /proc
add_apt_key "${DIR}" "http://apt.osmc.tv/apt.key"
verify_action
echo -e "Updating sources"
chroot ${DIR} apt-get update
verify_action
echo -e "Installing packages"
chroot ${DIR} apt-get -y install --no-install-recommends $CHROOT_PKGS
verify_action
echo -e "Configuring ccache"
configure_ccache "${DIR}"
verify_action
# Perform filesystem cleanup
chroot ${DIR} umount /proc
cleanup_filesystem "${DIR}"
# Build Debian package
echo "Building Debian package"
build_deb_package "${wd}" "${tcstub}"
verify_action
echo -e "Build successful"