[devmon 1.1.7] add option --enumerate-device-files #26
This commit is contained in:
parent
183013bec6
commit
8f1122f436
|
@ -8,6 +8,7 @@
|
|||
default fmask=0133 for vfat ntfs msdos umsdos #25
|
||||
[devmon 1.1.7] support raid /dev/mda in partition detection #28
|
||||
fix identify empty optical drive
|
||||
[devmon 1.1.7] add option --enumerate-device-files #26
|
||||
0.4.1 2013-03-17:
|
||||
update Russian translation
|
||||
added translation files to transifex.com
|
||||
|
|
34
src/devmon
34
src/devmon
|
@ -55,6 +55,7 @@ MOUNT-OPTIONS: (these can be used only in client mode)
|
|||
--mount DEVICE Mount DEVICE
|
||||
--mount-options|--mount-fstype|--eject-options "OPTIONS"
|
||||
These options will be passed to mount or eject
|
||||
--enumerate-device-files List known devices
|
||||
|
||||
UNIVERSAL OPTIONS: (these can be used in both daemon and client modes)
|
||||
--ignore-device DEVICE Ignore DEVICE (eg /dev/sdd1)
|
||||
|
@ -248,6 +249,39 @@ while [ "$1" != "" ]; do
|
|||
(( iglabx++ ))
|
||||
shift
|
||||
;;
|
||||
--enumerate-device-files )
|
||||
all=`grep " [ms]d[a-z0-9]*$" /proc/partitions | \
|
||||
sed 's/.* \([ms]d[a-z0-9]*\)/\/dev\/\1/'`
|
||||
n=$'\n'
|
||||
if [ "$all" != "" ]; then
|
||||
all="$all$n"
|
||||
fi
|
||||
for f in /dev/mapper/*; do
|
||||
if [ -h "$f" ]; then
|
||||
name="$(basename "$f")"
|
||||
target="$(readlink "$f")"
|
||||
target="$(basename "$target")"
|
||||
if [ "$target" != "" ]; then
|
||||
all="$all/dev/$target$n"
|
||||
if [ "${name:0:4}" = "loop" ]; then
|
||||
all="$all/dev/$name$n"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
done
|
||||
# add mounted loop devices (attached requires losetup as root)
|
||||
loop=`cat /proc/self/mountinfo 2>/dev/null | grep ' /dev/loop[0-9]* ' | cut -f9 -d ' ' 2>/dev/null`
|
||||
if [ "$loop" != "" ]; then
|
||||
loop="$loop$n"
|
||||
fi
|
||||
other=`/bin/ls -1 /dev/md[0-9]* /dev/dm-* /dev/sr* 2>/dev/null`
|
||||
if [ "$other" != "" ]; then
|
||||
other="$other$n"
|
||||
fi
|
||||
all="$all$loop$other"
|
||||
echo -n "$all" | sort | uniq
|
||||
exit
|
||||
;;
|
||||
--* )
|
||||
unknown "$1";;
|
||||
-* )
|
||||
|
|
Loading…
Reference in New Issue
Block a user