40 lines
996 B
Bash
40 lines
996 B
Bash
#!/bin/sh
|
|
|
|
SELF=$(readlink -f "$0")
|
|
SRCDIR=${SELF%/*}
|
|
. "${SRCDIR}"/lib/common.sh
|
|
|
|
base=aimee-os.org/gentoo/stage3-amd64-nomultilib-openrc:latest
|
|
while [ $# -gt 0 ]; do
|
|
case "$1" in
|
|
-b|--base)
|
|
shift
|
|
base="$1"
|
|
;;
|
|
*)
|
|
printf 'Unknown argument: %s\n' "$1" >&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
done
|
|
|
|
set -e
|
|
|
|
builddir=$(export TMPDIR=${TMPDIR:-${PWD}} && mktemp -d gentoo.XXXXXX)
|
|
builddir=$(readlink -f "${builddir}")
|
|
|
|
work=$(buildah from -v "${builddir}":/mnt/gentoo:rw,Z "${base}")
|
|
buildah add "${work}" portage /etc/portage/
|
|
buildah_run_script "${work}" "${SRCDIR}"/lib/sync.sh
|
|
buildah_run_script "${work}" "${SRCDIR}"/bootstrap.sh
|
|
|
|
cid=$(buildah from scratch)
|
|
buildah copy "${cid}" "${builddir}" /
|
|
buildah_run_script "${cid}" "${SRCDIR}"/profile.sh
|
|
buildah config --cmd /bin/bash "${cid}"
|
|
buildah commit --rm --squash "${cid}" aimee-os.org/build/base
|
|
|
|
buildah run "${work}" find /mnt/gentoo -mindepth 1 -delete
|
|
buildah rm "${work}"
|
|
rmdir "${builddir}"
|