Skip to content

Commit 1aca5d1

Browse files
jrtoddyzdykstra
authored andcommitted
Bug fixes and use local repository option for zbm-builder.sh
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.
1 parent 8b1aade commit 1aca5d1

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

zbm-builder.sh

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ Usage: $0 [options]
77
OPTIONS:
88
-h Display help text
99
10+
-L Use local './' source tree instead of remote.
11+
(Default: upstream master.)
12+
1013
-H Do not copy /etc/hostid into image
1114
(Has no effect if ./hostid exists)
1215
@@ -37,9 +40,13 @@ SKIP_CACHE=
3740
BUILD_TAG="ghcr.io/zbm-dev/zbm-builder:latest"
3841

3942
BUILD_ARGS=()
43+
VOLUME_ARGS=("-v" "${PWD}:/build")
4044

41-
while getopts "hHCdt:B:" opt; do
45+
while getopts "hHLCdt:B:" opt; do
4246
case "${opt}" in
47+
L)
48+
VOLUME_ARGS+=("-v" "${PWD}:/zbm")
49+
;;
4350
H)
4451
SKIP_HOSTID="yes"
4552
;;
@@ -95,8 +102,9 @@ fi
95102

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

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

0 commit comments

Comments
 (0)