Skip to content

Commit

Permalink
Bug fixes and use local repository option for zbm-builder.sh
Browse files Browse the repository at this point in the history
Fixes for the `zbm-builder.sh` script.

Unlike Podman, Docker does not accept `.` or `./` as arguments for bind volumes at the command line. Modifying `zbm-builder.sh` to use `${PWD}` instead of `.` works for both Docker and Podman.

A typo in the default `config.yaml` causes `zbm-build.sh` to fail, fixed.

Added option to use a local repository as opposed to a remote one.

Currently, `zbm-build.sh` is hard-coded to pull the required tag from `zbm-dev/zfsbootmenu`. Adding this command line option allows builds using a local repository tree.
  • Loading branch information
jrtoddy authored and zdykstra committed Mar 5, 2022
1 parent 8b1aade commit 1aca5d1
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions zbm-builder.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Usage: $0 [options]
OPTIONS:
-h Display help text
-L Use local './' source tree instead of remote.
(Default: upstream master.)
-H Do not copy /etc/hostid into image
(Has no effect if ./hostid exists)
Expand Down Expand Up @@ -37,9 +40,13 @@ SKIP_CACHE=
BUILD_TAG="ghcr.io/zbm-dev/zbm-builder:latest"

BUILD_ARGS=()
VOLUME_ARGS=("-v" "${PWD}:/build")

while getopts "hHCdt:B:" opt; do
while getopts "hHLCdt:B:" opt; do
case "${opt}" in
L)
VOLUME_ARGS+=("-v" "${PWD}:/zbm")
;;
H)
SKIP_HOSTID="yes"
;;
Expand Down Expand Up @@ -95,8 +102,9 @@ fi

# If no config is specified, use in-tree default
if ! [ -r ./config.yaml ]; then
BUILD_ARGS+=( "-c" "/zbm/etc/zfsbootomenu/config.yaml" )
BUILD_ARGS+=( "-c" "/zbm/etc/zfsbootmenu/config.yaml" )
fi

# Make `/build` the working directory so relative paths in a config file make sense
"${PODMAN}" run --rm -v ".:/build" -w "/build" "${BUILD_TAG}" "${BUILD_ARGS[@]}"
"${PODMAN}" run --rm "${VOLUME_ARGS[@]}" -w "/build" "${BUILD_TAG}" "${BUILD_ARGS[@]}"

0 comments on commit 1aca5d1

Please sign in to comment.