diff options
author | Mike Frysinger <vapier@gentoo.org> | 2005-03-01 22:45:26 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2005-03-01 22:45:26 +0000 |
commit | 07194185f9166bfc970eb6e4c84461c2a75427a7 (patch) | |
tree | 1f79b98dd16342126c82f1710c1c05574cc70256 /sys-fs/device-mapper/files | |
parent | old (diff) | |
download | gentoo-2-07194185f9166bfc970eb6e4c84461c2a75427a7.tar.gz gentoo-2-07194185f9166bfc970eb6e4c84461c2a75427a7.tar.bz2 gentoo-2-07194185f9166bfc970eb6e4c84461c2a75427a7.zip |
move from sys-libs
(Portage version: 2.0.51.18)
Diffstat (limited to 'sys-fs/device-mapper/files')
-rw-r--r-- | sys-fs/device-mapper/files/digest-device-mapper-1.00.17-r1 | 1 | ||||
-rw-r--r-- | sys-fs/device-mapper/files/digest-device-mapper-1.00.19-r2 | 1 | ||||
-rw-r--r-- | sys-fs/device-mapper/files/dm-start.sh | 80 | ||||
-rw-r--r-- | sys-fs/device-mapper/files/dmtab | 12 |
4 files changed, 94 insertions, 0 deletions
diff --git a/sys-fs/device-mapper/files/digest-device-mapper-1.00.17-r1 b/sys-fs/device-mapper/files/digest-device-mapper-1.00.17-r1 new file mode 100644 index 000000000000..fbd0ecb3318d --- /dev/null +++ b/sys-fs/device-mapper/files/digest-device-mapper-1.00.17-r1 @@ -0,0 +1 @@ +MD5 b74bb5fa232c77bf74f87eac2f53e1e4 device-mapper.1.00.17.tgz 637694 diff --git a/sys-fs/device-mapper/files/digest-device-mapper-1.00.19-r2 b/sys-fs/device-mapper/files/digest-device-mapper-1.00.19-r2 new file mode 100644 index 000000000000..689aeecbec74 --- /dev/null +++ b/sys-fs/device-mapper/files/digest-device-mapper-1.00.19-r2 @@ -0,0 +1 @@ +MD5 a7a97c469f22e3ec2cdcb5aae5603f3f device-mapper.1.00.19.tgz 640411 diff --git a/sys-fs/device-mapper/files/dm-start.sh b/sys-fs/device-mapper/files/dm-start.sh new file mode 100644 index 000000000000..5770ca6a9a17 --- /dev/null +++ b/sys-fs/device-mapper/files/dm-start.sh @@ -0,0 +1,80 @@ +# /lib/rcscripts/addons/dm-start.sh: Setup DM volumes at boot +# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/files/dm-start.sh,v 1.1 2005/03/01 22:45:26 vapier Exp $ + +# char **get_new_dm_volumes(void) +# +# Return dmsetup commands to setup volumes +get_new_dm_volumes() { + local volume params + + # Filter comments and blank lines + grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \ + while read volume params; do + # If it exists, skip it + dmvolume_exists "${volume%:}" && continue + # Assemble the command to run to create volume + echo "echo ${params} | /sbin/dmsetup create ${volume%:}" + done + + return 0 +} + +# int dmvolume_exists(volume) +# +# Return true if volume exists in DM table +dmvolume_exists() { + local x line volume=$1 + + [[ -z ${volume} ]] && return 1 + + while read line; do + for x in ${line}; do + [[ ${x} == "${volume}" ]] && return 0 + # We only want to check the volume name + break + done + done <<<"$(/sbin/dmsetup ls 2>/dev/null)" + + return 1 +} + +# int is_empty_dm_volume(volume) +# +# Return true if the volume exists in DM table, but is empty/non-valid +is_empty_dm_volume() { + local table volume=$1 + + table=$(/sbin/dmsetup table 2>/dev/null | grep -e "^${volume}:") + + # dmsetup seems to print an space after the colon for the moment + [[ -n ${table} && -z ${table/${volume}:*} ]] && return 0 + + return 1 +} + +local x volume + +if [[ -x /sbin/dmsetup && -c /dev/mapper/control && -f /etc/dmtab ]]; then + [[ -n $(get_new_dm_volumes) ]] && \ + einfo " Setting up device-mapper volumes:" + + while read x; do + [[ -n ${x} ]] || continue + + volume="${x##* }" + + ebegin " Creating volume: ${volume}" + if ! eval ${x} &>/dev/null; then + eend 1 " Error creating volume: ${volume}" + # dmsetup still adds an empty volume in some cases, + # so lets remove it + is_empty_dm_volume "${volume}" && \ + /sbin/dmsetup remove "${volume}" &>/dev/null + else + eend 0 + fi + done <<< "$(get_new_dm_volumes)" +fi + + +# vim:ts=4 diff --git a/sys-fs/device-mapper/files/dmtab b/sys-fs/device-mapper/files/dmtab new file mode 100644 index 000000000000..96c6640675a7 --- /dev/null +++ b/sys-fs/device-mapper/files/dmtab @@ -0,0 +1,12 @@ +#/etc/dmraid: config file for adding device-mapper volumes at boot +# $Header: /var/cvsroot/gentoo-x86/sys-fs/device-mapper/files/dmtab,v 1.1 2005/03/01 22:45:26 vapier Exp $ + +# Format: <volume name>: <table> +# Example: isw0: 0 312602976 striped 2 128 /dev/sda 0 /dev/sdb 0 +# +# Alternatively you can create all your volumes the first time, and just run: +# +# dmsetup table >> /etc/dmtab +# +# and verify that they are correct. + |