Skip to content

Commit 235eb17

Browse files
committed
Stop installing zpool.cache
None of the `zpool import` instances actually use the cache file, so there is no value in including it in the initramfs.
1 parent bfb635f commit 235eb17

6 files changed

Lines changed: 14 additions & 51 deletions

File tree

‎docs/BUILD.md‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ The default behavior of `zbm-builder.sh` will:
6060

6161
1. Pull the default builder image, `ghcr.io/zbm-dev/zbm-builder:latest`.
6262
2. If `./hostid` does not exist, copy `/etc/hostid` (if it exists) to `./hostid`.
63-
3. If `./zpool.cache` does not exist, copy `/etc/zfs/zpool.cache` to `./zpool.cache`.
64-
4. Spawn an ephemeral container from the builder image and run its build process:
63+
3. Spawn an ephemeral container from the builder image and run its build process:
6564
1. Bind-mount the working directory into the container to expose local configurations to the builder
6665
2. If `./config.yaml` exists, inform the builder to use that custom configuration instead of the default
6766
3. Run the internal build script to produce output in the `./build` subdirectory

‎dracut/module-setup.sh‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,14 +168,9 @@ install() {
168168
exit 1
169169
fi
170170

171-
# zpool.cache, vdev_id.conf and hostid files are host-specific
171+
# vdev_id.conf and hostid files are host-specific
172172
# and do not belong in public release images
173173
if [ -z "${release_build}" ]; then
174-
if [ -e /etc/zfs/zpool.cache ]; then
175-
inst /etc/zfs/zpool.cache
176-
type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/zfs/zpool.cache
177-
fi
178-
179174
if [ -e /etc/zfs/vdev_id.conf ]; then
180175
inst /etc/zfs/vdev_id.conf
181176
type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/zfs/vdev_id.conf

‎initcpio/install/zfsbootmenu‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@ build() {
186186

187187
# Copy host-specific ZFS configs
188188
[[ -f /etc/hostid ]] && add_file "/etc/hostid"
189-
[[ -f /etc/zfs/zpool.cache ]] && add_file "/etc/zfs/zpool.cache"
190189
[[ -f /etc/zfs/vdev_id.conf ]] && add_file "/etc/zfs/vdev_id.conf"
191190
[[ -f /etc/modprobe.d/zfs.conf ]] && add_file "/etc/modprobe.d/zfs.conf"
192191

‎releng/docker/README.md‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,9 @@ each level of configurations to mask or augment earlier defaults.
185185
> `mkinitcpio.conf` that manually sources these snippets to emulate the
186186
> standard configuration behavior of dracut.
187187
188-
In addition, host-specific files are linked if each exists:
188+
In addition, the hostid file is linked if it exists:
189189

190190
/etc/hostid -> ${BUILDROOT}/hostid
191-
/etc/zfs/zpool.cache -> ${BUILDROOT}/zfs/zpool.cache
192191

193192
When launched, the container entrypoint will run any executable files it finds
194193
in `${BUILDROOT}/rc.d`. This provides a means to "terraform" the build
@@ -227,7 +226,7 @@ the `/etc/zfsbootmenu/build` directory, copy the desired files and run the
227226
container with the appropriate volume mount:
228227

229228
```sh
230-
cp /etc/hostid /etc/zfs/zpool.cache /etc/zfsbootmenu/build
229+
cp /etc/hostid /etc/zfsbootmenu/build
231230
podman run -v /etc/zfsbootmenu/build:/build zbm
232231
```
233232

‎releng/docker/build-init.sh‎

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,22 +170,14 @@ CONFIGEVALS+=(
170170
"del(.Global.BootMountPoint)"
171171
)
172172

173-
# Use provided hostid and zpool.cache files
173+
# Use provided hostid
174174
if [ -r "${BUILDROOT}/hostid" ]; then
175175
ln -Tsf "${BUILDROOT}/hostid" /etc/hostid \
176176
|| error "failed to link hostid"
177177
else
178178
rm -f /etc/hostid
179179
fi
180180

181-
if [ -r "${BUILDROOT}/zpool.cache" ]; then
182-
mkdir -p /etc/zfs
183-
ln -Tsf "${BUILDROOT}/zpool.cache" /etc/zfs/zpool.cache \
184-
|| error "failed to link zpool.cache"
185-
else
186-
rm -f /etc/zfs/zpool.cache
187-
fi
188-
189181
# Link all configuration files in standard location;
190182
# go from most generic to most specificj
191183
mkdir -p /etc/zfsbootmenu

‎zbm-builder.sh‎

Lines changed: 9 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,7 @@ OPTIONS:
5959
Build from ZFSBootMenu source tree at
6060
(Default: fetch upstream source tree inside container)
6161
62-
-R Remove any existing zpool.cache and hostid in the build directory
63-
64-
-C Do not include host /etc/zfs/zpool.cache in image
65-
(If ./zpool.cache exists, this switch will be ignored)
62+
-R Remove any existing hostid in the build directory
6663
6764
-H Do not include host /etc/hostid in image
6865
(If ./hostid exists, this switch will be ignored)
@@ -78,7 +75,6 @@ EOF
7875
}
7976

8077
SKIP_HOSTID=
81-
SKIP_CACHE=
8278
REMOVE_HOST_FILES=
8379

8480
# By default, use the latest upstream build container image
@@ -105,7 +101,7 @@ else
105101
PODMAN="docker"
106102
fi
107103

108-
CMDOPTS="b:dhi:l:c:O:CHR"
104+
CMDOPTS="b:dhi:l:c:O:HR"
109105

110106
# First pass to get build directory and configuration file
111107
while getopts "${CMDOPTS}" opt; do
@@ -163,9 +159,6 @@ while getopts "${CMDOPTS}" opt; do
163159
O)
164160
RUNTIME_ARGS+=( "${OPTARG}" )
165161
;;
166-
C)
167-
SKIP_CACHE="yes"
168-
;;
169162
H)
170163
SKIP_HOSTID="yes"
171164
;;
@@ -200,16 +193,13 @@ if [ -n "${BUILD_REPO}" ]; then
200193
RUNTIME_ARGS+=( "-v" "${BUILD_REPO}:/zbm:ro" )
201194
fi
202195

203-
if boolean_enabled "${REMOVE_HOST_FILES}"; then
204-
# Remove existing host files
205-
for host_file in "hostid" "zpool.cache"; do
206-
[ -e "${BUILD_DIRECTORY}/${host_file}" ] || continue
207-
if ! rm "${BUILD_DIRECTORY}/${host_file}"; then
208-
echo "ERROR: failed to remove file '${host_file}' from build directory"
209-
exit 1
210-
fi
211-
echo "Removed file '${host_file}' by user request"
212-
done
196+
# Remove existing hostid
197+
if boolean_enabled "${REMOVE_HOST_FILES}" && [ -e "${BUILD_DIRECTORY}/hostid" ]; then
198+
if ! rm "${BUILD_DIRECTORY}/hostid"; then
199+
echo "ERROR: failed to remove hostid from build directory"
200+
exit 1
201+
fi
202+
echo "Removed hostid by user request"
213203
fi
214204

215205
# If no local hostid is available, copy the system hostid if desired
@@ -223,17 +213,6 @@ if ! [ -r "${BUILD_DIRECTORY}"/hostid ]; then
223213
fi
224214
fi
225215

226-
# If no local zpool.cache is available, copy the system cache if desired
227-
if ! [ -r "${BUILD_DIRECTORY}"/zpool.cache ]; then
228-
if ! boolean_enabled "${SKIP_CACHE}" && [ -r /etc/zfs/zpool.cache ]; then
229-
if ! cp /etc/zfs/zpool.cache "${BUILD_DIRECTORY}"/zpool.cache; then
230-
echo "ERROR: unable to copy /etc/zfs/zpool.cache"
231-
echo "Copy a zpool cache to ./zpool.cache or use -C to disable"
232-
exit 1
233-
fi
234-
fi
235-
fi
236-
237216
# If no config is specified, use in-tree default but force EFI and components
238217
if ! [ -r "${BUILD_DIRECTORY}"/config.yaml ]; then
239218
BUILD_ARGS=(

0 commit comments

Comments
 (0)