From d10b901de697a124d6b2223f0fab23800e87f5b8 Mon Sep 17 00:00:00 2001
From: "Alan J. Pippin" <ajp@pippins.net>
Date: Sat, 31 Dec 2022 09:54:27 -0700
Subject: [PATCH] Add -f to zpool import commands

Change-Id: I37bd5b1989b546e32f81fe0a559372134d158700
---
 zfs-replicate-all | 2 +-
 zfs-scrub         | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/zfs-replicate-all b/zfs-replicate-all
index c8a8b03..5dde8b2 100755
--- a/zfs-replicate-all
+++ b/zfs-replicate-all
@@ -101,7 +101,7 @@ for backup_pool in $backup_pools; do
 zpool list -H $backup_pool > $tmpfile 2>&1
 if [ $? != 0 ]; then
   if [[ $import_export_backup_pool == 1 ]]; then
-    zpool import $backup_pool >> $tmpfile 2>&1
+    zpool import -f $backup_pool >> $tmpfile 2>&1
     if [ $? != 0 ]; then
       msgs=`cat $tmpfile`
       fatal_and_exit "-E- unable to import the backup pool '$backup_pool' on $hostname: $msgs" "$mailto"
diff --git a/zfs-scrub b/zfs-scrub
index 5388f54..4e22027 100755
--- a/zfs-scrub
+++ b/zfs-scrub
@@ -35,7 +35,7 @@ do
   zpool list -H "$i" >/dev/null 2>&1
   if [ $? != 0 ]; then
     if [[ $import_export_backup_pool == 1 ]] && [[ "$backup_pool" =~ "$i" ]]; then
-      zpool import $i
+      zpool import -f $i
       if [ $? != 0 ]; then
         fatal_and_exit "-E- unable to import the pool $i"
       fi
@@ -85,7 +85,7 @@ do
   zpool list -H "$i" >/dev/null 2>&1
   if [ $? != 0 ]; then
     if [[ $import_export_backup_pool == 1 ]] && [[ "$backup_pool" =~ "$i" ]]; then
-      zpool import $i
+      zpool import -f $i
       if [ $? != 0 ]; then
         fatal_and_exit "-E- unable to import the pool $i"
       fi
-- 
2.34.1