diff --git a/utils/btrfs-progs/Makefile b/utils/btrfs-progs/Makefile index 167c51c85..3ad77c981 100644 --- a/utils/btrfs-progs/Makefile +++ b/utils/btrfs-progs/Makefile @@ -79,8 +79,8 @@ define Package/btrfs-progs/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/btrfs.box $(1)/usr/bin/btrfs $(foreach prog,$(boxprogs),$(LN) btrfs $(1)/usr/bin/$(prog);) $(foreach prog,$(progs),$(INSTALL_BIN) $(PKG_BUILD_DIR)/$(prog) $(1)/usr/bin/;) - $(INSTALL_DIR) $(1)/etc/init.d - $(INSTALL_BIN) ./files/btrfs-scan.init $(1)/etc/init.d/btrfs-scan + $(INSTALL_DIR) $(1)/lib/preinit + $(INSTALL_BIN) ./files/btrfs-scan.init $(1)/lib/preinit/85_btrfs_scan endef $(eval $(call BuildPackage,btrfs-progs)) diff --git a/utils/btrfs-progs/files/btrfs-scan.init b/utils/btrfs-progs/files/btrfs-scan.init index 762e0b840..608d3d6c5 100644 --- a/utils/btrfs-progs/files/btrfs-scan.init +++ b/utils/btrfs-progs/files/btrfs-scan.init @@ -1,9 +1,7 @@ -#!/bin/sh /etc/rc.common -# Copyright (C) 2014 OpenWrt.org +#!/bin/sh -START=19 - -start() { - grep -q btrfs /proc/filesystems && /usr/bin/btrfs device scan +preinit_btrfs_scan() { + grep -vq btrfs /proc/filesystems || btrfs device scan } +boot_hook_add preinit_main preinit_btrfs_scan