aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2023-10-17 20:41:37 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2023-10-17 20:41:37 +0000
commit593cb078d4e91591aa3be823715f11888b21f8e4 (patch)
treec77599a69be3de5989792bd1786eecd298913b97
parent89427a6328a737b6a64104a6988e4ab319f239c7 (diff)
downloadsg3_utils-593cb078d4e91591aa3be823715f11888b21f8e4.tar.gz
rescan-scsi-bus.sh: remove /tmp/rescan-scsi-mpath-info.txt; https://github.com/doug-gilbert/sg3_utils/pull/44.diff
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@1056 6180dd3e-e324-4e3e-922d-17de1ae2f315
-rw-r--r--ChangeLog3
-rwxr-xr-xscripts/rescan-scsi-bus.sh16
2 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 8a9f1d85..9dab4783 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@ Each utility has its own version number, date of last change and
some description at the top of its ".c" file. All utilities in the main
directory have their own "man" pages. There is also a sg3_utils man page.
-Changelog for pre-release sg3_utils-1.49 [20231016] [svn: r1055]
+Changelog for pre-release sg3_utils-1.49 [20231017] [svn: r1056]
- apply https://github.com/doug-gilbert/sg3_utils/pull/39
and its revision [20230807] mainly for Android
- sg_inq: update version descriptors to T10 table 20230814
@@ -17,6 +17,7 @@ Changelog for pre-release sg3_utils-1.49 [20231016] [svn: r1055]
- sg_get_elem_status: various improvements
- rescan-scsi-bus.sh: fix multipath resize without update
https://github.com/doug-gilbert/sg3_utils/pull/43.diff
+ and 44.diff
- new error code: SG_LIB_PROGRESS_NOT_READY for long
duration 'in progress' additional sense codes
- lib/sg_pt_solaris.c : fix compilation issue per
diff --git a/scripts/rescan-scsi-bus.sh b/scripts/rescan-scsi-bus.sh
index 7d74d90f..188d071c 100755
--- a/scripts/rescan-scsi-bus.sh
+++ b/scripts/rescan-scsi-bus.sh
@@ -7,7 +7,16 @@
VERSION="20230413"
SCAN_WILD_CARD=4294967295
-TMPLUNINFOFILE="/tmp/rescan-scsi-mpath-info.txt"
+CLEANUP=:
+trap 'eval "$CLEANUP"' 0
+TMPD=$(mktemp -d /tmp/rsb.XXXXXXXX)
+[ "$TMPD" ] || {
+ echo failed to create temporary directory >&2
+ exit 1
+}
+CLEANUP='rm -rf "$TMPD";'"$CLEANUP"
+
+TMPLUNINFOFILE="$TMPD/rescan-scsi-mpath-info.txt"
setcolor ()
{
@@ -818,9 +827,9 @@ findremapped()
mpaths=""
local tmpfile=
- tmpfile=$(mktemp /tmp/rescan-scsi-bus.XXXXXXXX 2> /dev/null)
+ tmpfile=$(mktemp "$TMPD/rescan-scsi-bus.XXXXXXXX" 2> /dev/null)
if [ -z "$tmpfile" ] ; then
- tmpfile="/tmp/rescan-scsi-bus.$$"
+ tmpfile="$TMPD/rescan-scsi-bus.$$"
rm -f $tmpfile
fi
@@ -874,7 +883,6 @@ findremapped()
echo "$SCSISTR"
incrchgd "$hctl"
done < $tmpfile
- rm -f $tmpfile
if [ -n "$mp_enable" ] && [ -n "$mpaths" ] ; then
echo "Updating multipath device mappings"