build: Implement CONFIGDIR setting

In effort to support different builds of Aimee OS using the same
scripts, without necessarily having to fork this repository, the build
system now supports a `CONFIGDIR` setting.  When this variable is set,
files defining the target environment, such as the lists of packages to
install, the kernel configuration, the Portage configuration, etc. are
found in the path it specifes.

The reference build, for the Home Assistant Yellow board, is configured
in the `yellow` directory.  To build it, run:

```sh
CONFIGDIR=yellow ./vm-build.sh
```
This commit is contained in:
2023-03-13 16:21:20 -05:00
parent 1914b3aba0
commit 31d8a98f64
100 changed files with 83 additions and 53 deletions

View File

@@ -3,19 +3,19 @@
set -e
. ./config
. "${CONFIGDIR:=${PWD}}"/config
mkdir -p portage/config/target/etc/portage/repos.conf
mkdir -p "${CONFIGDIR}"/portage/target/etc/portage/repos.conf
cat > portage/config/target/etc/portage/repos.conf/aimee-os.conf <<EOF
cat > "${CONFIGDIR}"/portage/target/etc/portage/repos.conf/aimee-os.conf <<EOF
[aimee-os]
location = ${PWD}/portage/repos/aimee-os
location = ${PWD}/repos/aimee-os
auto-sync = no
EOF
cat > portage/config/target/etc/portage/repos.conf/x-portage.conf <<EOF
cat > "${CONFIGDIR}"/portage/target/etc/portage/repos.conf/x-portage.conf <<EOF
[x-portage]
location = ${PWD}/portage/repos/x-portage
location = ${PWD}/repos/x-portage
auto-sync = no
EOF
@@ -24,9 +24,9 @@ for patch in patches/ebuilds/*/*/*.patch; do
cp=${patch#patches/ebuilds/}
cp=${cp%/*.patch}
printf 'Applying patch %s for %s ...\n' "${patch##*/}" "${cp}"
mkdir -p portage/repos/x-portage/${cp}
cp -r /var/db/repos/gentoo/${cp}/. portage/repos/x-portage/${cp}
for f in portage/repos/x-portage/${cp}/*.ebuild; do
mkdir -p repos/x-portage/${cp}
cp -r /var/db/repos/gentoo/${cp}/. repos/x-portage/${cp}
for f in repos/x-portage/${cp}/*.ebuild; do
patch "${f}" "${patch}"
ebuild "${f}" digest
done