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.
This commit is contained in:
parent
bfb635fb48
commit
235eb17d1a
|
@ -60,8 +60,7 @@ The default behavior of `zbm-builder.sh` will:
|
|||
|
||||
1. Pull the default builder image, `ghcr.io/zbm-dev/zbm-builder:latest`.
|
||||
2. If `./hostid` does not exist, copy `/etc/hostid` (if it exists) to `./hostid`.
|
||||
3. If `./zpool.cache` does not exist, copy `/etc/zfs/zpool.cache` to `./zpool.cache`.
|
||||
4. Spawn an ephemeral container from the builder image and run its build process:
|
||||
3. Spawn an ephemeral container from the builder image and run its build process:
|
||||
1. Bind-mount the working directory into the container to expose local configurations to the builder
|
||||
2. If `./config.yaml` exists, inform the builder to use that custom configuration instead of the default
|
||||
3. Run the internal build script to produce output in the `./build` subdirectory
|
||||
|
|
|
@ -168,14 +168,9 @@ install() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# zpool.cache, vdev_id.conf and hostid files are host-specific
|
||||
# vdev_id.conf and hostid files are host-specific
|
||||
# and do not belong in public release images
|
||||
if [ -z "${release_build}" ]; then
|
||||
if [ -e /etc/zfs/zpool.cache ]; then
|
||||
inst /etc/zfs/zpool.cache
|
||||
type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/zfs/zpool.cache
|
||||
fi
|
||||
|
||||
if [ -e /etc/zfs/vdev_id.conf ]; then
|
||||
inst /etc/zfs/vdev_id.conf
|
||||
type mark_hostonly >/dev/null 2>&1 && mark_hostonly /etc/zfs/vdev_id.conf
|
||||
|
|
|
@ -186,7 +186,6 @@ build() {
|
|||
|
||||
# Copy host-specific ZFS configs
|
||||
[[ -f /etc/hostid ]] && add_file "/etc/hostid"
|
||||
[[ -f /etc/zfs/zpool.cache ]] && add_file "/etc/zfs/zpool.cache"
|
||||
[[ -f /etc/zfs/vdev_id.conf ]] && add_file "/etc/zfs/vdev_id.conf"
|
||||
[[ -f /etc/modprobe.d/zfs.conf ]] && add_file "/etc/modprobe.d/zfs.conf"
|
||||
|
||||
|
|
|
@ -185,10 +185,9 @@ each level of configurations to mask or augment earlier defaults.
|
|||
> `mkinitcpio.conf` that manually sources these snippets to emulate the
|
||||
> standard configuration behavior of dracut.
|
||||
|
||||
In addition, host-specific files are linked if each exists:
|
||||
In addition, the hostid file is linked if it exists:
|
||||
|
||||
/etc/hostid -> ${BUILDROOT}/hostid
|
||||
/etc/zfs/zpool.cache -> ${BUILDROOT}/zfs/zpool.cache
|
||||
|
||||
When launched, the container entrypoint will run any executable files it finds
|
||||
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
|
|||
container with the appropriate volume mount:
|
||||
|
||||
```sh
|
||||
cp /etc/hostid /etc/zfs/zpool.cache /etc/zfsbootmenu/build
|
||||
cp /etc/hostid /etc/zfsbootmenu/build
|
||||
podman run -v /etc/zfsbootmenu/build:/build zbm
|
||||
```
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ CONFIGEVALS+=(
|
|||
"del(.Global.BootMountPoint)"
|
||||
)
|
||||
|
||||
# Use provided hostid and zpool.cache files
|
||||
# Use provided hostid
|
||||
if [ -r "${BUILDROOT}/hostid" ]; then
|
||||
ln -Tsf "${BUILDROOT}/hostid" /etc/hostid \
|
||||
|| error "failed to link hostid"
|
||||
|
@ -178,14 +178,6 @@ else
|
|||
rm -f /etc/hostid
|
||||
fi
|
||||
|
||||
if [ -r "${BUILDROOT}/zpool.cache" ]; then
|
||||
mkdir -p /etc/zfs
|
||||
ln -Tsf "${BUILDROOT}/zpool.cache" /etc/zfs/zpool.cache \
|
||||
|| error "failed to link zpool.cache"
|
||||
else
|
||||
rm -f /etc/zfs/zpool.cache
|
||||
fi
|
||||
|
||||
# Link all configuration files in standard location;
|
||||
# go from most generic to most specificj
|
||||
mkdir -p /etc/zfsbootmenu
|
||||
|
|
|
@ -59,10 +59,7 @@ OPTIONS:
|
|||
Build from ZFSBootMenu source tree at <path>
|
||||
(Default: fetch upstream source tree inside container)
|
||||
|
||||
-R Remove any existing zpool.cache and hostid in the build directory
|
||||
|
||||
-C Do not include host /etc/zfs/zpool.cache in image
|
||||
(If ./zpool.cache exists, this switch will be ignored)
|
||||
-R Remove any existing hostid in the build directory
|
||||
|
||||
-H Do not include host /etc/hostid in image
|
||||
(If ./hostid exists, this switch will be ignored)
|
||||
|
@ -78,7 +75,6 @@ EOF
|
|||
}
|
||||
|
||||
SKIP_HOSTID=
|
||||
SKIP_CACHE=
|
||||
REMOVE_HOST_FILES=
|
||||
|
||||
# By default, use the latest upstream build container image
|
||||
|
@ -105,7 +101,7 @@ else
|
|||
PODMAN="docker"
|
||||
fi
|
||||
|
||||
CMDOPTS="b:dhi:l:c:O:CHR"
|
||||
CMDOPTS="b:dhi:l:c:O:HR"
|
||||
|
||||
# First pass to get build directory and configuration file
|
||||
while getopts "${CMDOPTS}" opt; do
|
||||
|
@ -163,9 +159,6 @@ while getopts "${CMDOPTS}" opt; do
|
|||
O)
|
||||
RUNTIME_ARGS+=( "${OPTARG}" )
|
||||
;;
|
||||
C)
|
||||
SKIP_CACHE="yes"
|
||||
;;
|
||||
H)
|
||||
SKIP_HOSTID="yes"
|
||||
;;
|
||||
|
@ -200,16 +193,13 @@ if [ -n "${BUILD_REPO}" ]; then
|
|||
RUNTIME_ARGS+=( "-v" "${BUILD_REPO}:/zbm:ro" )
|
||||
fi
|
||||
|
||||
if boolean_enabled "${REMOVE_HOST_FILES}"; then
|
||||
# Remove existing host files
|
||||
for host_file in "hostid" "zpool.cache"; do
|
||||
[ -e "${BUILD_DIRECTORY}/${host_file}" ] || continue
|
||||
if ! rm "${BUILD_DIRECTORY}/${host_file}"; then
|
||||
echo "ERROR: failed to remove file '${host_file}' from build directory"
|
||||
exit 1
|
||||
fi
|
||||
echo "Removed file '${host_file}' by user request"
|
||||
done
|
||||
# Remove existing hostid
|
||||
if boolean_enabled "${REMOVE_HOST_FILES}" && [ -e "${BUILD_DIRECTORY}/hostid" ]; then
|
||||
if ! rm "${BUILD_DIRECTORY}/hostid"; then
|
||||
echo "ERROR: failed to remove hostid from build directory"
|
||||
exit 1
|
||||
fi
|
||||
echo "Removed hostid by user request"
|
||||
fi
|
||||
|
||||
# If no local hostid is available, copy the system hostid if desired
|
||||
|
@ -223,17 +213,6 @@ if ! [ -r "${BUILD_DIRECTORY}"/hostid ]; then
|
|||
fi
|
||||
fi
|
||||
|
||||
# If no local zpool.cache is available, copy the system cache if desired
|
||||
if ! [ -r "${BUILD_DIRECTORY}"/zpool.cache ]; then
|
||||
if ! boolean_enabled "${SKIP_CACHE}" && [ -r /etc/zfs/zpool.cache ]; then
|
||||
if ! cp /etc/zfs/zpool.cache "${BUILD_DIRECTORY}"/zpool.cache; then
|
||||
echo "ERROR: unable to copy /etc/zfs/zpool.cache"
|
||||
echo "Copy a zpool cache to ./zpool.cache or use -C to disable"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# If no config is specified, use in-tree default but force EFI and components
|
||||
if ! [ -r "${BUILD_DIRECTORY}"/config.yaml ]; then
|
||||
BUILD_ARGS=(
|
||||
|
|
Loading…
Reference in New Issue