diff --git a/tests/linux/hwloc-gather-topology.sh.in b/tests/linux/hwloc-gather-topology.sh.in index 5a3deab..1740ade 100755 --- a/tests/linux/hwloc-gather-topology.sh.in +++ b/tests/linux/hwloc-gather-topology.sh.in @@ -20,12 +20,19 @@ error() echo $@ 2>&1 } +usage() +{ + echo "$0 " + echo " Saves the Linux topology files (/sys, /proc, ...) under .tar.bz2" + echo " and the corresponding lstopo verbose output under .output" + echo "Example:" + echo " $0 /tmp/\$(uname -n)" +} + name="$1"; shift -if [ -z "$name" ] ; then - echo "$0 " - echo " Saves the Linux topology files (/sys, /proc, ...) under .tar.bz2" - echo " and the corresponding lstopo verbose output under .output" - exit -1 +if [ -z "$name" -o x`echo $name | cut -c1` = x- ] ; then + usage + exit 1 fi basename=`basename "$name"` dirname=`dirname "$name"` @@ -35,6 +42,11 @@ if ! mkdir -p "$dirname" ; then exit 1 fi +if [ ! -w "$dirname" ] ; then + echo "$dirname is not writable." + exit 1 +fi + destdir=`mktemp -d` # Use cat so that we properly get proc/sys files even if their