blob: ebcf5ed6c97bed0cc689865c7f052f0ba3e8cb15 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#!/bin/bash
# Helper to call 'dmsetup setup' without syncing with udev
# and then actively create the devices with the mknodes command.
# Either pass the table contents as $2, or pipe them into the function
# dmsetup_create_noudevsync <name> [table]
(
set -eo pipefail
if [ -n "$2" ]; then
printf "%s\n" "$2" | dmsetup create "$1" --noudevsync
else
dmsetup create "$1" --noudevsync
fi
dmsetup mknodes --noudevsync "$1"
echo "dm: Created $1"
)
ret=$?
[ -b "/dev/mapper/$1" ] || ret=99
if [ $ret -ne 0 ]; then
echo "dm: Error creating $1, removing..."
dmsetup remove --noudevsync "$1"
fi
exit $ret
|