Skip to content

Commit

Permalink
ZQuickinit 1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
midzelis committed Oct 20, 2023
1 parent e614f71 commit dc2e1bc
Show file tree
Hide file tree
Showing 86 changed files with 2,637 additions and 728 deletions.
17 changes: 17 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.git
.github
.gitignore
*.dockerignore
Dockerfile
.env
output
*.qcow2
hostname
ttyd_pushover.conf
tailscaled.state*
*.efi
*.iso
cache
*.test*
*ssh_host*
*.code-workspace
83 changes: 83 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Create Release

on:
workflow_dispatch:
inputs:
tag:
description: 'The next release tag to use'
required: false
type: string
push:
branches:
- 'main'
tags:
- 'v*'

# Ensures that only one deploy task per branch/environment will run at a time.
concurrency:
group: environment-${{ github.ref }}
cancel-in-progress: true

env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
install: true
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Expose GitHub Runtime
uses: crazy-max/ghaction-github-runtime@v3
# - name: Env
# run: |
# # ACTIONS_RUNTIME_TOKEN, ACTIONS_RUNTIME_URL should be exposed
# env|sort
- name: Check out the repository to the runner
uses: actions/checkout@v4
# - name: Set up caching
# In this step, this action saves a list of existing images,
# the cache is created without them in the post run.
# It also restores the cache if it exists.
# uses: jpribyl/[email protected]
# # Ignore the failure of a step and avoid terminating the job.
# continue-on-error: true
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/[email protected]
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ inputs.tag }}
- name: Build the builder
run: ./zquickinit.sh builder --githubaction --load
- name: Push OCI package to registry
run: ./zquickinit.sh builder --githubaction --push --tag ghcr.io/midzelis/zquickinit:latest --tag ghcr.io/midzelis/zquickinit:${{ steps.tag_version.outputs.new_tag }}
- name: Build initramfs
run: ./zquickinit.sh initramfs --noask --release
- name: Build ISO
run: sudo apt-get install -y mtools xorriso coreutils findutils && ./zquickinit.sh iso
- name: Create a GitHub release
uses: ncipollo/[email protected]
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
removeArtifacts: true
artifacts: "output/zquickinit.efi,zquickinit.iso"
allowUpdates: true
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
output
*.qcow2
hostname
ez_webttyd_pushover.conf
ttyd_pushover.conf
tailscaled.state*
*.test.*
*.efi
*.iso
cache
*test*
*ssh_host*
.code-workspace
4 changes: 4 additions & 0 deletions Acknowledgements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Acknowledgements

Many thanks to the [ZFSBootMenu](zfsbootmenu.org) project which is used as the basis and inspiration for all of the `ZQuickInit` scripts layered on top.

50 changes: 32 additions & 18 deletions build/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@

# Use the official Void Linux container
FROM ghcr.io/void-linux/void-glibc-full
LABEL org.opencontainers.image.authors="ZFSBootMenu Team, https://zfsbootmenu.org"
LABEL org.opencontainers.image.source https://github.com/midzelis/zquickinit

ARG XBPS_REPOS="https://repo-fastly.voidlinux.org/current https://repo-fastly.voidlinux.org/current/nonfree"

# Include the specified Void Linux kernel series in the image; kernel
# series take the form <major>.<minor> and correspond to Void packages
# linux<kver> and linux<kver>-headers
#
# Default: install 5.10, 5.15 and 6.1
# Default: install 5.10, 5.15, 6.1 and 6.2
#
# (multiple entries must be seperated by spaces)
ARG KERNELS="linux5.10 linux5.15 linux6.1"
ARG KERNELS="linux5.10 linux5.15 linux6.1 linux6.2"

# Run the following within an external cache (/var/cache/xbps) for the
# package manager; so when this layer is rebuilt, at least you save
# some bandwidth.
RUN --mount=type=cache,target=/var/cache/xbps <<-EOF
RUN --mount=type=cache,target=/var/cache/xbps <<-EOF
# Update repos and install kernels and base dependencies.
[ -n "${KERNELS}" ] || { echo "ARG KERNELS must contain a value"; exit 1; }

Expand Down Expand Up @@ -59,7 +59,7 @@ RUN --mount=type=cache,target=/var/cache/xbps <<-EOF

xbps-install -y ${KERNELS} ${kern_headers} ${zbm_deps} \
zstd gummiboot-efistub curl yq-go bash kbd terminus-font \
dracut mkinitcpio dracut-network gptfdisk iproute2 iputils parted \
mkinitcpio gptfdisk iproute2 iputils parted \
curl dosfstools e2fsprogs efibootmgr cryptsetup openssh util-linux kpartx git

# Remove headers and development toolchain, but keep binutils for objcopy
Expand All @@ -74,16 +74,6 @@ RUN <<-EOF
xbps-reconfigure -f glibc-locales
EOF

# ZFSBootMenu commit hash, tag or branch name used by
# default to build ZFSBootMenu images (default: master)
ARG ZBM_COMMIT_HASH
RUN <<-EOF
# Record a commit hash if one was provided
if [ -n "${ZBM_COMMIT_HASH}" ]; then
echo "${ZBM_COMMIT_HASH}" > /etc/zbm-commit-hash
fi
EOF

# Include the specified Void Linux package in the image
#
# (multiple entries must be seperated by spaces)
Expand All @@ -92,15 +82,39 @@ ARG PACKAGES=
# are not rebuilt when ${PACKAGES} change. reuse. Additionally: use xbps cache.
RUN --mount=type=cache,target=/var/cache/xbps <<-EOF
# Install ZFSBootMenu dependencies and components necessary to build images
xbps-install -S
xbps-install -y ${PACKAGES}
EOF

# Free space in image
RUN rm -f /var/cache/xbps/*

COPY --chmod=755 bake.sh /
# ZFSBootMenu commit hash, tag or branch name used by
# default to build ZFSBootMenu images (default: master)
ARG ZBM_COMMIT_HASH
RUN <<-EOF
# Record a commit hash if one was provided
if [ -n "${ZBM_COMMIT_HASH}" ]; then
echo "Using zfsbootmenu commit hash: ${ZQUICKINIT_COMMIT_HASH}"
echo "${ZBM_COMMIT_HASH}" > /etc/zbm-commit-hash
mkdir -p /zbm
echo "Cloning https://github.com/zbm-dev/zfsbootmenu.git"
git clone --quiet --depth 1 ${branch} https://github.com/zbm-dev/zfsbootmenu.git /zbm
(cd /zbm && git fetch --depth 1 origin "${ZBM_COMMIT_HASH}" && git checkout FETCH_HEAD)
fi
EOF

# ZQuickInit source
RUN <<-EOF
ZQUICKINIT_COMMIT_HASH=$(git rev-parse HEAD)
echo "Using zquickinit commit hash: ${ZQUICKINIT_COMMIT_HASH}"
echo "${ZQUICKINIT_COMMIT_HASH}" > /etc/zquickinit-commit-hash
EOF

COPY . /input/
COPY --chmod=755 zquickinit.sh /

# Run the build script with no arguments by default
ENTRYPOINT [ "/bake.sh" ]
ENTRYPOINT [ "/zquickinit.sh" ]
ENV RUNNING_IN_CONTAINER=1
CMD [ "interactive" ]
ENV TERM=xterm-256color
9 changes: 9 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
The MIT License (MIT)

Copyright 2023 Min Idzelis

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit dc2e1bc

Please sign in to comment.