-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
including builder_example in docs/ #2
Open
MalteJ
wants to merge
2
commits into
main
Choose a base branch
from
feat/docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Builder Example | ||
|
||
This is a basic example of utilizing the *Garden Linux Builder*. | ||
|
||
To build this example run | ||
|
||
./build base | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eufo pipefail | ||
|
||
container_image=ghcr.io/gardenlinux/builder:5d05982bf4132b0d7814080ea3042344d500adc3 | ||
container_engine=podman | ||
|
||
container_run_opts=( | ||
--security-opt seccomp=unconfined | ||
--security-opt apparmor=unconfined | ||
--security-opt label=disable | ||
--read-only | ||
) | ||
|
||
container_mount_opts=( | ||
-v "$PWD/features:/builder/features:ro" | ||
-v "$PWD/keyring.gpg:/builder/keyring.gpg:ro" | ||
-v "$PWD/.build:/builder/.build" | ||
) | ||
|
||
use_kms=0 | ||
resolve_cname=0 | ||
|
||
while [ $# -gt 0 ]; do | ||
case "$1" in | ||
--container-image) | ||
container_image="$2" | ||
shift 2 | ||
;; | ||
--container-engine) | ||
container_engine="$2" | ||
shift 2 | ||
;; | ||
--container-run-opts) | ||
declare -a "container_run_opts=($2)" | ||
shift 2 | ||
;; | ||
--kms) | ||
use_kms=1 | ||
shift | ||
;; | ||
--print-container-image) | ||
printf '%s\n' "$container_image" | ||
exit 0 | ||
;; | ||
--resolve-cname) | ||
resolve_cname=1 | ||
shift | ||
;; | ||
*) | ||
break | ||
;; | ||
esac | ||
done | ||
|
||
if [ "$container_image" = localhost/builder ]; then | ||
dir="$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")" | ||
"$container_engine" build -t "$container_image" "$dir" | ||
fi | ||
|
||
repo="$(./get_repo)" | ||
commit="$(./get_commit)" | ||
timestamp="$(./get_timestamp)" | ||
default_version="$(./get_version)" | ||
|
||
[ -d .build ] || mkdir .build | ||
|
||
if [ "$resolve_cname" = 1 ]; then | ||
arch="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" dpkg --print-architecture)" | ||
cname="$("$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" /builder/parse_features --feature-dir /builder/features --default-arch "$arch" --default-version "$default_version" --cname "$1")" | ||
short_commit="$(head -c 8 <<< "$commit")" | ||
echo "$cname-$short_commit" | ||
exit 0 | ||
fi | ||
|
||
make_opts=( | ||
REPO="$repo" | ||
COMMIT="$commit" | ||
TIMESTAMP="$timestamp" | ||
DEFAULT_VERSION="$default_version" | ||
) | ||
|
||
if [ "$use_kms" = 1 ]; then | ||
for e in AWS_DEFAULT_REGION AWS_REGION AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN; do | ||
if [ -n "${!e-}" ]; then | ||
make_opts+=("$e=${!e}") | ||
fi | ||
done | ||
fi | ||
|
||
if [ -d cert ]; then | ||
container_mount_opts+=(-v "$PWD/cert:/builder/cert:ro") | ||
fi | ||
|
||
"$container_engine" run --rm "${container_run_opts[@]}" "${container_mount_opts[@]}" "$container_image" make --no-print-directory -C /builder "${make_opts[@]}" "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
systemctl enable systemd-networkd | ||
systemctl enable systemd-resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
mkdir -p /etc/kernel | ||
echo "root=LABEL=ROOT ro" > /etc/kernel/cmdline | ||
|
||
mkdir -p /boot/efi/Default | ||
|
||
kernel="$(find /boot -name 'vmlinuz-*' | sort -V | tail -n 1)" | ||
version="${kernel#*-}" | ||
|
||
unshare --mount bash -c 'mount -t tmpfs none /sys && mount --bind /usr/bin/false /usr/bin/systemd-detect-virt && "$@"' \ | ||
DRACUT_COMPRESS_XZ="$(command -v xz)" dracut \ | ||
--no-hostonly \ | ||
--force \ | ||
--kver "$version" \ | ||
--modules "bash dash systemd systemd-initrd kernel-modules kernel-modules-extra terminfo udev-rules dracut-systemd base fs-lib shutdown" \ | ||
--reproducible \ | ||
"/boot/initrd.img-$version" | ||
|
||
kernel-install add "$version" "$kernel" | ||
|
||
sed 's/boot\/efi\///' -i /boot/efi/loader/entries/*.conf | ||
|
||
SYSTEMD_ESP_PATH=/boot/efi bootctl --no-variables install |
5 changes: 5 additions & 0 deletions
5
docs/example/features/base/file.include/etc/systemd/network/99-default.network
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[Match] | ||
Name=en* eth* | ||
|
||
[Network] | ||
DHCP=yes |
3 changes: 3 additions & 0 deletions
3
...mple/features/base/file.include/etc/systemd/system/[email protected]/autologin.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[Service] | ||
ExecStart= | ||
ExecStart=-/sbin/agetty --autologin root -o '-p -f -- \\u' --keep-baud 115200,38400,9600 %I $TERM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# <file system> <dir> <type> <options> <makeimg args> | ||
LABEL=EFI /boot/efi vfat umask=0077 type=uefi | ||
LABEL=ROOT / ext4 rw,errors=remount-ro,prjquota,discard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
description: base | ||
type: platform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dracut | ||
iproute2 | ||
linux-image-$arch | ||
systemd | ||
systemd-boot | ||
systemd-resolved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eufo pipefail | ||
|
||
dir="$(dirname "${BASH_SOURCE[0]}")" | ||
cd "$dir" | ||
[ -z "$(git status --porcelain 2> /dev/null)" ] && git rev-parse HEAD 2> /dev/null || echo local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eufo pipefail | ||
|
||
echo "http://deb.debian.org/debian" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eufo pipefail | ||
|
||
echo 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eufo pipefail | ||
|
||
echo bookworm |
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not copy the files also in
docs/example
, this would introduce duplicates (e.g.build
anddocs/example/build
).Question is: How do I update the build script in gardenlinux/gardenlinux/build with latest changes from gardenlinux/builder/build?