Fix initramfs hook installation

We have to create the final hook before installation for debian package
builds.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
Kent Overstreet 2025-09-17 00:37:46 -04:00
parent 7d37ce6485
commit 993396bb57
3 changed files with 8 additions and 10 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ cscope*
bcachefs-tools
compile_commands.json
dkms/dkms.conf
initramfs/hook
# dot-files that we don't want to ignore
!.gitignore

View File

@ -200,13 +200,16 @@ endif
# Rebuild the 'version' command any time the version string changes
cmd_version.o : .version
dkms/dkms.conf:
dkms/dkms.conf: dkms/dkms.conf.in
sed "s|@PACKAGE_VERSION@|$(VERSION)|g" dkms/dkms.conf.in > dkms/dkms.conf
initramfs/hook: initramfs/hook.in
sed "s|@ROOT_SBINDIR@|$(ROOT_SBINDIR)|g" initramfs/hook.in > initramfs/hook
.PHONY: install
install: INITRAMFS_HOOK=$(INITRAMFS_DIR)/hooks/bcachefs
install: INITRAMFS_SCRIPT=$(INITRAMFS_DIR)/scripts/local-premount/bcachefs
install: bcachefs install_dkms $(optional_install)
install: bcachefs initramfs/hook install_dkms $(optional_install)
$(INSTALL) -m0755 -D $(BUILT_BIN) -t $(DESTDIR)$(ROOT_SBINDIR)
$(INSTALL) -m0644 -D bcachefs.8 -t $(DESTDIR)$(PREFIX)/share/man/man8/
$(INSTALL) -m0755 -D initramfs/script $(DESTDIR)$(INITRAMFS_SCRIPT)
@ -219,10 +222,6 @@ install: bcachefs install_dkms $(optional_install)
$(LN) -sfr $(DESTDIR)$(ROOT_SBINDIR)/bcachefs $(DESTDIR)$(ROOT_SBINDIR)/fsck.fuse.bcachefs
$(LN) -sfr $(DESTDIR)$(ROOT_SBINDIR)/bcachefs $(DESTDIR)$(ROOT_SBINDIR)/mount.fuse.bcachefs
sed -i '/^# Note: make install replaces/,$$d' $(DESTDIR)$(INITRAMFS_HOOK)
echo "copy_exec $(ROOT_SBINDIR)/bcachefs /sbin/bcachefs" >> $(DESTDIR)$(INITRAMFS_HOOK)
echo "copy_exec $(ROOT_SBINDIR)/mount.bcachefs /sbin/mount.bcachefs" >> $(DESTDIR)$(INITRAMFS_HOOK)
.PHONY: install_systemd
install_systemd: $(systemd_services) $(systemd_libexecfiles)
$(INSTALL) -m0755 -D $(systemd_libexecfiles) -t $(DESTDIR)$(LIBEXECDIR)

View File

@ -22,7 +22,5 @@ manual_add_modules 'bcachefs'
add_loaded_modules 'chacha20[-_]*'
add_loaded_modules 'poly1305[-_]*'
# Add the bcachefs utility to the initramfs
# Note: make install replaces this with the install path, so it must be last
#copy_exec /usr/local/sbin/bcachefs /sbin/bcachefs
#copy_exec /usr/local/sbin/mount.bcachefs /sbin/mount.bcachefs
copy_exec @ROOT_SBINDIR@/bcachefs /sbin/bcachefs
copy_exec @ROOT_SBINDIR@/mount.bcachefs /sbin/mount.bcachefs