mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-09 05:56:58 +02:00
This uses Gentoo's catalyst for very thoroughly building images from scratch. Using images based on this will eliminate some of the hackery in make_chroot.sh for building up the sdk from a stock stage3 tarball. For reference the procedure it performs is this: 1. snapshot: Grab a snapshot of portage-stable. Note that overalys are not snapshotted. 2. stage1: Using a "seed" tarball as a build environment, build a minimal root file system into a clean directory using ROOT=... and USE=-* The restricted USE flags are key be small and avoid circular dependencies. 3. stage2: Run portage-stable/scripts/bootstrap.sh This rebuilds the toolchain. Probably not strictly necessary most of the time but does super-duper-promise that the toolchain isn't linked to or otherwise influenced by whatever was in the "seed" tarball. 4. stage3: Run emerge -e system to rebuild everything using the fresh toolchain using the normal USE flags provided by the profile. This will also pull in assorted base system packages that weren't included in the minimal environment stage1 created. 5. stage4: Install any extra packages or other desired tweaks. For the sdk we just install all the packages normally make_chroot.sh does.
22 lines
538 B
Bash
22 lines
538 B
Bash
#!/bin/bash
|
|
|
|
# setup some configs catalyst doesn't handle
|
|
# i.e: update locale.gen to speed up builds
|
|
maybe_append() {
|
|
[[ -f "$1" && ! -w "$1" ]] && return
|
|
if ! grep -q "^$2" "$1"; then
|
|
echo "$2" >> "$1"
|
|
fi
|
|
}
|
|
|
|
fixup_rootfs() {
|
|
mkdir -p "$1/etc" 2>/dev/null || return
|
|
maybe_append "$1/etc/locale.gen" "en_US ISO-8859-1"
|
|
maybe_append "$1/etc/locale.gen" "en_US.UTF-8 UTF-8"
|
|
}
|
|
|
|
# Fix both / and $ROOT (if it exists)
|
|
fixup_rootfs
|
|
[[ "${ROOT:-/}" != / ]] && fixup_rootfs "$ROOT"
|
|
unset fixup_rootfs maybe_append
|