summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-07-24 10:25:01 -0700
committerBrian Behlendorf <[email protected]>2009-07-24 10:25:01 -0700
commit710c21f2e9a4cfd8210d558dd34525fdaf7e501f (patch)
tree544d9c5aad317d789cd66c1bb029b0108ca642f1 /scripts
parent82ca18caaee24d4638c11377bef2734a8260be49 (diff)
Use LOSETUP variable for all calls to /sbin/losetup
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/common.sh6
-rw-r--r--scripts/zpool-config/lo-raid0.sh6
-rw-r--r--scripts/zpool-config/lo-raid10.sh8
-rw-r--r--scripts/zpool-config/lo-raidz.sh6
-rw-r--r--scripts/zpool-config/lo-raidz2.sh6
5 files changed, 17 insertions, 15 deletions
diff --git a/scripts/common.sh b/scripts/common.sh
index 6e19bbf83..f7944fe31 100755
--- a/scripts/common.sh
+++ b/scripts/common.sh
@@ -18,6 +18,8 @@ DUMP_LOG=
ERROR=
MODULES=()
+LOSETUP=/sbin/losetup
+
die() {
echo -e "${PROG}: $1" >&2
exit 1
@@ -146,9 +148,9 @@ unload_modules() {
unused_loop_device() {
for DEVICE in `ls -1 /dev/loop*`; do
- losetup $DEVICE &>/dev/null
+ ${LOSETUP} ${DEVICE} &>/dev/null
if [ $? -ne 0 ]; then
- echo $DEVICE
+ echo ${DEVICE}
return
fi
done
diff --git a/scripts/zpool-config/lo-raid0.sh b/scripts/zpool-config/lo-raid0.sh
index 36b3c4d62..b514499bc 100644
--- a/scripts/zpool-config/lo-raid0.sh
+++ b/scripts/zpool-config/lo-raid0.sh
@@ -16,7 +16,7 @@ zpool_create() {
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||
die "Error $? creating ${FILE}"
- losetup ${DEVICE} ${FILE} ||
+ ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES="${DEVICES} ${DEVICE}"
done
@@ -30,9 +30,9 @@ zpool_destroy() {
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
- DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1|cut -f1 -d:`
+ DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`
msg "Removing ${FILE} using loopback device ${DEVICE}"
- losetup -d ${DEVICE} ||
+ ${LOSETUP} -d ${DEVICE} ||
die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${FILE} || exit 1
done
diff --git a/scripts/zpool-config/lo-raid10.sh b/scripts/zpool-config/lo-raid10.sh
index 64602aec3..237666949 100644
--- a/scripts/zpool-config/lo-raid10.sh
+++ b/scripts/zpool-config/lo-raid10.sh
@@ -18,7 +18,7 @@ zpool_create() {
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||
die "Error $? creating ${FILE}"
- losetup ${DEVICE} ${FILE} ||
+ ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES_M1="${DEVICES_M1} ${DEVICE}"
done
@@ -29,7 +29,7 @@ zpool_create() {
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||
die "Error $? creating ${FILE}"
- losetup ${DEVICE} ${FILE} ||
+ ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES_M2="${DEVICES_M2} ${DEVICE}"
done
@@ -45,9 +45,9 @@ zpool_destroy() {
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
- DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1|cut -f1 -d:`
+ DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`
msg "Removing ${FILE} using loopback device ${DEVICE}"
- losetup -d ${DEVICE} ||
+ ${LOSETUP} -d ${DEVICE} ||
die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${FILE} || exit 1
done
diff --git a/scripts/zpool-config/lo-raidz.sh b/scripts/zpool-config/lo-raidz.sh
index 616c364be..9ec90e2bc 100644
--- a/scripts/zpool-config/lo-raidz.sh
+++ b/scripts/zpool-config/lo-raidz.sh
@@ -16,7 +16,7 @@ zpool_create() {
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||
die "Error $? creating ${FILE}"
- losetup ${DEVICE} ${FILE} ||
+ ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES="${DEVICES} ${DEVICE}"
done
@@ -30,9 +30,9 @@ zpool_destroy() {
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
- DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1|cut -f1 -d:`
+ DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`
msg "Removing ${FILE} using loopback device ${DEVICE}"
- losetup -d ${DEVICE} ||
+ ${LOSETUP} -d ${DEVICE} ||
die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${FILE} || exit 1
done
diff --git a/scripts/zpool-config/lo-raidz2.sh b/scripts/zpool-config/lo-raidz2.sh
index dbd7d815e..2883d7f9f 100644
--- a/scripts/zpool-config/lo-raidz2.sh
+++ b/scripts/zpool-config/lo-raidz2.sh
@@ -16,7 +16,7 @@ zpool_create() {
rm -f ${FILE} || exit 1
dd if=/dev/zero of=${FILE} bs=1024k count=256 &>/dev/null ||
die "Error $? creating ${FILE}"
- losetup ${DEVICE} ${FILE} ||
+ ${LOSETUP} ${DEVICE} ${FILE} ||
die "Error $? creating ${FILE} -> ${DEVICE} loopback"
DEVICES="${DEVICES} ${DEVICE}"
done
@@ -30,9 +30,9 @@ zpool_destroy() {
${CMDDIR}/zpool/zpool destroy ${ZPOOL_NAME}
for FILE in ${FILES}; do
- DEVICE=`/sbin/losetup -a | grep ${FILE} | head -n1|cut -f1 -d:`
+ DEVICE=`${LOSETUP} -a | grep ${FILE} | head -n1|cut -f1 -d:`
msg "Removing ${FILE} using loopback device ${DEVICE}"
- losetup -d ${DEVICE} ||
+ ${LOSETUP} -d ${DEVICE} ||
die "Error $? destroying ${FILE} -> ${DEVICE} loopback"
rm -f ${FILE} || exit 1
done