Skip to content

Commit 6e80c1b

Browse files
authored
Merge pull request #3755 from joolswills/chroot_builder_changes
Chroot builder changes
2 parents 083362d + 1e7d9ef commit 6e80c1b

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

scriptmodules/admin/builder.sh

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,17 @@ function chroot_build_builder() {
8383

8484
local dist
8585
local dists="$__builder_dists"
86-
[[ -z "$dists" ]] && dists="buster"
86+
[[ -z "$dists" ]] && return 1
8787

8888
local platform
8989
local platforms="$__builder_platforms"
90-
[[ -z "$platforms" ]] && platforms="rpi1 rpi2 rpi4"
9190

9291
for dist in $dists; do
92+
[[ -z "$platforms" ]] && platforms="$(_get_info_image "$dist" "platforms")"
93+
9394
local chroot_dir="$md_build/$dist"
9495
local chroot_rps_dir="$chroot_dir/home/pi/RetroPie-Setup"
95-
local archive_dir="tmp/archives/$dist"
96+
local archive_dir="tmp/archives/$(_get_info_image "$dist" "name")"
9697

9798
local distcc_hosts="$__builder_distcc_hosts"
9899
if [[ -d "$rootdir/admin/crosscomp/$dist" ]]; then
@@ -117,18 +118,13 @@ function chroot_build_builder() {
117118
sudo apt-get install -y git; \
118119
"
119120
# copy existing packages from host if building in a clean chroot to avoid rebuilding everything
120-
mkdir -p "$chroot_rps_dir/$archive_dir"
121+
mkdir -p "$scriptdir/$archive_dir/" "$chroot_rps_dir/$archive_dir"
121122
rsync -av "$scriptdir/$archive_dir/" "$chroot_rps_dir/$archive_dir/"
122123
else
123124
sudo -u $user git -C "$chroot_rps_dir" pull
124125
fi
125126

126127
for platform in $platforms; do
127-
if [[ "$dist" == "stretch" && "$platform" == "rpi4" ]]; then
128-
printMsgs "heading" "Skipping platform $platform on $dist ..."
129-
continue
130-
fi
131-
132128
rp_callModule image chroot "$chroot_dir" \
133129
sudo \
134130
__use_ccache="$use_ccache" \

scriptmodules/admin/image.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ function depends_image() {
2323
function _get_info_image() {
2424
local dist="$1"
2525
local key="$2"
26-
local ini="$md_data/dists/${dist}.ini"
26+
# don't use $md_data so this function can be used directly from builder.sh
27+
local ini="${__mod_info[image/path]%/*}/image/dists/${dist}.ini"
2728
[[ ! -f "$ini" ]] && fatalError "Definition file $ini does not exist"
2829

2930
iniConfig "=" "\"" "$ini"
@@ -37,7 +38,7 @@ function create_chroot_image() {
3738
[[ -z "$dist" ]] && return 1
3839

3940
local chroot="$2"
40-
[[ -z "$chroot" ]] && chroot="$md_build/chroot"
41+
[[ -z "$chroot" ]] && chroot="$md_build/$dist"
4142

4243
mkdir -p "$md_build"
4344
pushd "$md_build"
@@ -105,7 +106,7 @@ function install_rp_image() {
105106
fi
106107

107108
local chroot="$3"
108-
[[ -z "$chroot" ]] && chroot="$md_build/chroot"
109+
[[ -z "$chroot" ]] && chroot="$md_build/$dist"
109110

110111
local dist_version="$(_get_info_image "$dist" "version")"
111112

@@ -180,6 +181,9 @@ _EOF_
180181
}
181182

182183
function _init_chroot_image() {
184+
local chroot="$1"
185+
[[ -z "$chroot" ]] && return 1
186+
183187
# unmount on ctrl+c
184188
trap "_trap_chroot_image '$chroot'" INT
185189

@@ -202,7 +206,7 @@ function _init_chroot_image() {
202206

203207
function _deinit_chroot_image() {
204208
local chroot="$1"
205-
[[ -z "$chroot" ]] && chroot="$md_build/chroot"
209+
[[ -z "$chroot" ]] && return 1
206210

207211
trap "" INT
208212

@@ -224,7 +228,7 @@ function _trap_chroot_image() {
224228

225229
function chroot_image() {
226230
local chroot="$1"
227-
[[ -z "$chroot" ]] && chroot="$md_build/chroot"
231+
[[ -z "$chroot" ]] && return 1
228232
shift
229233

230234
printMsgs "console" "Chrooting to $chroot ..."
@@ -311,7 +315,7 @@ function create_bb_image() {
311315
[[ -z "$image" ]] && return 1
312316

313317
local chroot="$2"
314-
[[ -z "$chroot" ]] && chroot="$md_build/chroot"
318+
[[ -z "$chroot" ]] && return 1
315319

316320
# replace fstab
317321
echo "proc /proc proc defaults 0 0" >"$chroot/etc/fstab"
@@ -346,7 +350,7 @@ function platform_image() {
346350
printMsgs "heading" "Building $platform image based on $dist ..."
347351

348352
rp_callModule image create_chroot "$dist"
349-
rp_callModule image install_rp "$platform" "$dist" "$md_build/chroot"
353+
rp_callModule image install_rp "$platform" "$dist" "$md_build/$dist"
350354

351355
local dist_name="$(_get_info_image "$dist" "name")"
352356
local file_add="$(_get_info_image "$dist" "file_${platform}")"

scriptmodules/admin/image/dists/rpios-stretch.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name="stretch"
22
version="9"
33
url="https://downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2019-04-09/2019-04-08-raspbian-stretch-lite.zip"
4-
format="xz"
4+
format="zip"
55
platforms="rpi1 rpi2"
66
file_rpi1="rpi1_zero"
77
title_rpi1="RPI 1/Zero"

0 commit comments

Comments
 (0)