sys-fs/lvm2: Add version 2.02.177 with musl support and Red Hat patches #2

Merged
alex merged 1 commits from lvm2-177 into master 2020-12-13 16:32:24 +03:00
29 changed files with 1329 additions and 0 deletions

29
sys-fs/lvm2/Manifest Normal file
View File

@ -0,0 +1,29 @@
AUX clvmd.confd-2.02.39 213 BLAKE2B bfca5c33cbff432427291c162f8e1c5172957c4d1dbabae8605bf1aab7aaf0c8d9b1b67f81219b3a3ae0822e0a9e17c8bde2b59c27a0fafd8495b67e0c7708c5 SHA512 9614c4188c9a5bcf398d1f521b52d7e2281fcdf76265fdaca4acda22be282d8468e82b54a2661d5753f4b9a442ebe93a60daf87c846db4e275a283f71c9fd8e2
AUX clvmd.rc-2.02.39 3590 BLAKE2B 6ea7d9a112a98baed0c8d96e19804cadc82cc326fd6db00947631f3ef10791f0cf7888a250aeb8e37b6149302b26310c305c4a46cb8eef2dee00f0d0238c9943 SHA512 2a16b700f475a65477d548b4cb5fb26129c86d2244b7b5716ffdb4e9b13cf2e37bc1fc986c080c5c4d1c0e2b5436b0cc6fcb0527c9b98c1b29b85ca512551532
AUX device-mapper.conf-1.02.22-r3 15 BLAKE2B c8954f4cad3090e95c8ab985f7f93b65add66b9014351aab82d270c371c3b7571a73b37b2002664b50c21bb7dd494c7196857de75b41ca534cb15e0127f080ae SHA512 1846e0ca1be7170d4c0beb694a23aea4d19b24b99a248bb0f4e034286a6beede0a8efc474b0c237e33ee72c86c93b6238f2d5ea23e224765acba99c90633261e
AUX device-mapper.rc-2.02.105-r2 3707 BLAKE2B 1f1f38fd377e77e082985146de8a32fb88f794e4db28d6790cccbc6a87b63b0d28617e5fa7eb4974e2dcf8a80265accf8b69ff0719fa3de1c6788e7d5a1bd705 SHA512 9940b1154a8c07cf2f2c975e209bfb1e78913d3ea77ac6334684a9b38c4f4bd34b349b71c078c9ad5700f554046771ee05e17f07b75dc4e7d839f1df2305cc4f
AUX dmeventd.initd-2.02.67-r1 565 BLAKE2B ca1f5d205191076114d4a89717b304df04a520a22630ed84e78550e83b9364e049457bacfcadcc8ca1328a78c97412a445fcf153871266355379eab423c38138 SHA512 c0f5317ab0cba700eab3b643fd134d8a23fe4b332c47fd94728e43dfdf97250561f60ecb47808d2c65e55cdec65cccbd51f264540c0d973b2df7ded4ec129c34
AUX dmtab 319 BLAKE2B 5753b72e44325e467c0e4ea1bbce8faafe1c5e2509d2e02a5ad428b39e531c655014a3b151f7bc57513aae74983a60cfe3034432ffd21d39716fc6893ec7da8f SHA512 a8cc69ff832eafd64d7e45854df3380a9c5f9648297e2606c5b9b47e0015c93c7da6ef3dfd35800f36a3371635fa1906605c524be82d6740fd435c7f6bf2807b
AUX lvm-monitoring.initd-2.02.105-r2 963 BLAKE2B 2a193578c642e05a2a492fb025bdacd2594953405a58517bf6a93a04db29be03e16a33b2c5cd57c463f55f30fd47a4fb7766f52b149a298db4dcefed4ed30012 SHA512 dc13304e8d644a55f0490c84acc36b95f43fc0e86c4b44f85f54f6ed3213ad665454e7432b3621f307b3468af0c33525c24705f4a2783e35a26e02ff1c828779
AUX lvm.confd-2.02.28-r2 173 BLAKE2B 4b9d115ed31b3777bd3c925b75bd0ebb186bace92b6d294e6a1ff7cdb7c206374a06738a73edc401a5547016a08721013fe3ad66b52d8cf08de75d030813ab2d SHA512 67b153cbc5c2327c15f042b3b5590c1d8fdf9823efb19c80192ac4dcf98e530efea8ecae0aaaa4a54b0e3e4907565aa21455b364df1dbe8f2e7dffa1c5d355d0
AUX lvm.rc-2.02.172 4207 BLAKE2B 9c3e4ca320fda3ae587d908f416f8730c8965f3eea1b79fdd9453c505793870d7ceea0a8f305efaf8579805c773cffac084bc62854eb7a61bceec7f29c3bb183 SHA512 8aff8ed7f854dd326dd78c4862cd0a518deed10e05533d0a17fe47c18db8bf29b26799950f534b52aeabacd3fb70d83f12c523cab0a0f2d669aa0ff9d3fa1832
AUX lvm2-2.02.129-example.conf.in.patch 1844 BLAKE2B 60e717f172557800c9a797309188b88bd601f3491d54d7dc0320e40b4b4825c20b70e07f9737d3e109746523c16ec29519f18fae10e9c56b3a936e082b8e308d SHA512 a2bceec0d051fd2f7749e702d6bbabbc0edf98b11b3211256d2a49d781b1fe89071f36052045726b11b0e0bdd98242b88fc57128a048a7d6d6448c298a6233ed
AUX lvm2-2.02.166-HPPA-no-O_DIRECT.patch 285 BLAKE2B 0311aab5b4ac843ff36fb7c4dbb8f47538fb621848f8430118dbbbcdfbf64876098ce9732109dca00e9262551b12a0e3293f0edfbb82dadf2d442f448dd695a3 SHA512 e113c31400d9f382b89901be199dfd3dd3888e0b417fb080d381d2aab79ac522dc968fda6aa7fd7668d018fd9109be133252cce01825bf950a79da145ff8b240
AUX lvm2-2.02.176-pthread-pkgconfig.patch 822 BLAKE2B 9c5d89a70c0a7074d689f8f50a1f811b91fe8a64b564e22426bce4574be165765b3640f8dc650e4ae047340a03390fc70faff0cd78ef5251063d28030e1f495f SHA512 d96f579bbdc56b8288fa01e6c416bfcf229c92b659102edd1aa10c9ae1c35eeecb4299bce161218dae423995431e8a12a2a78a80a868b79744f74053ec2f9bd2
AUX lvm2-2.02.183-fix-stdio-usage.patch 870 BLAKE2B e92a605f5adffe8d63b330450b2d65f29745f869e5bb360641e4af7dc2ada066bbd227ada28cc5d5f536193acebc662b46cb73bf154f246e7235e43a4dc4963c SHA512 505205665bbef9faa55bd1081897a5c561dc5093eec799a744e57aabccf4dff20cb72ea6ada232a04d63e6a5ccc45905f575c7bcc39819a4170fdeb4050ddde0
AUX lvm2-2.02.183-implement-libc-specific-reopen_stream.patch 646 BLAKE2B cc229e506d2f5f10d64e579e404b845525b9a26b32d7e6d87274f500f90dd5b0e7f25ac5d7b89623c06c08e6d8e7161d05477ddb1249a73cca4e6081006951b2 SHA512 f7941f0a4f61b62b218c5635ca86dc79f9cd77b30dc391509ee41635c957e3f06041bf45b12eff8894b22377684dcb93a648385d062a9b2fa2322add3513942a
AUX lvm2-2.02.183-portability.patch 567 BLAKE2B e165297ec7c9bf65bf0f460e9a03da5733b816c59dda852800dcfe7d141304fec4b8955c863f6708d49ce1a58380ddf0d17916c26e305ddfccb06fa499415c5f SHA512 9595a6760e0eeae44f58733e775c572cce24e95bb78db1bafd534a906d19b937a48358d9b75d34e1d22473da1a70f275fcdd1e7fbe2f97c4f6ef7cdef2df285b
AUX lvm2-2.02.56-lvm2create_initrd.patch 2032 BLAKE2B 5533ceb7a601d58995e7a90b1355508907edb30d14704b397a8c8ba0d66dbcd3d6b02ace1cadef1dfbb1d927449403f76f0f38e5d034344b3232deb512507cb6 SHA512 b2a1705fa6b962027ebc5047583547489afe8ef8d8977c6284a28d0a8b0e05e20e6c48bd6c02a8bb02de9cfb40ac2d6e2a4b8ed8ef8c4ae7b6ea9a29bc4194de
AUX lvm2-2.02.63-always-make-static-libdm.patch 1420 BLAKE2B baf7010b5965f5c2b9a32ec812cb259cb3ceccea0d56e48d75e9f8e872634913f160fcfff0c2c77854ddfeaafb3b48bbca16d569041ab6f45aecb950f8e5bf4a SHA512 67735af9e51369d5b3b400cab4f9ffa25f8dea1c1ec3d01855cb3c5aeade5c39a35eeed43f3a665204fe6bbba4ca43baecd845330bf26d023064b94ca3d1317c
AUX lvm2-2.02.67-createinitrd.patch 660 BLAKE2B 23e784e6769bc1f47fa57d690e6bebdf16d784d775a06af1c8eb7c54dd63a12abb0edd8331c8d033d7a0dda058252453a46dd35bd820fd47ba1407e9568b3858 SHA512 17fbba5d34ece5c1c25ef35fa3bbc3d6fcd20b44bd766c049bbc120853a8d60c9544db5790645a7814db5c272fd12d383699a8a9be6f4e9c56a7c0a1bb29ade2
AUX lvm2-2.02.99-locale-muck.patch 405 BLAKE2B 07ac7c7f54d06dbdeae1c6bf0959fd0c223b30cbd67c08f853e02f520d212f7b6dcf7c3b6c3d3b7370bb004adbb23b226bf0d0792b5799ddbaff5ab655124ca2 SHA512 1c898693f71d165d55458ab87886a25206930c202b5aea95eba394ad06162cc710c1435e598acb9bcd3fbf46abf5409be972f6ce73bd02b2e177e1af780ae7ad
AUX lvm2-2_02_178-lvmlockd-fix-uninitialized.patch 521 BLAKE2B 5cb393f62a298985a5034446ecf390f031bd228fb70233e2243742a7b403b4b98cf463412e9dcd2a08ddf6e8855ddda3a26b4bf2f861d29c4363b5fb2a3e4ede SHA512 f0eb17cb9ffe3ae3193142e9082a7b0f53c05effcf020c627a01b81d3733efacdd4e7d7b17e147b9ddfca61eb7ed8ebdf6fdeb7db5d54210ed936a7dcf741f1f
AUX lvm2-2_02_180-filter-use-valid-pointers.patch 720 BLAKE2B f5025cbc71b32435d4fd243367cb3c298d2bcb4e28a7e0647c72d1e2bf120587030e786985074aee970cf323739b5f72ba90f6245ab7d464f1926590fe097732 SHA512 c1303ecd83136387c5ee0781de7b64a83ebf06b3c990b84dcd93ed183b1e830ea8fc94a76e08dd0cfc34fdb723607d79124451f5218cb77b199745d7d0d55445
AUX lvm2-lvmetad-timeout.patch 583 BLAKE2B 7a72fa79309d6c34484a247f4cdacfc0aa6447a2ca5ebf55a145612c131d85c79086237e397c7b60188d0f282014f3d0570c946dd3a98d9c84588e7cab41fcfe SHA512 e94b6eb6e583d893c47242b9c796e898feaef0b58c2e6fc2060f3f828936bc71560ea836576c5f9be738df0f8f5b61a7525a7d94d6813a067f0a50f64c78435e
AUX lvm2-set-default-preferred_names.patch 1535 BLAKE2B f35b29e3bc352f4963ba8f147ef87320fb1b133f8a27f3858200046dc746b72540e3b333b2475e113052a71faa11011579d35b8809b9630653b9ccebb3af5f64 SHA512 4495642b851a4f19c1f2017a270ad3383e55aca4506f55aa39d351c7e6817bbc401328ac8ef323435baf5b5a6a59d479dc2d9b8242cdaf597ef11d26907acdaf
AUX lvmetad.initd-2.02.105-r2 287 BLAKE2B 613baa6c794a971257ea25061d51ce2923475e919c6753e99e8fd2f7e8542ac48b1207f851c3c200b7a4113a62ef5bc2dc5507bcd5ad6c47bec8c9a3abc1ad63 SHA512 5fe1a47a1c54546af70c64fc001db3111e519cb81d8672761b64f50b4c552d0fa79bd0770fb4f4f3e0e0ac584b1e13ea91ac1a33cea1cc1f484cff0dde1a3b0b
AUX lvmetad.initd-2.02.116-r3 348 BLAKE2B 6ad8f51dc6498703840a0917cdbcb5d1f179e2f8f0b2bc06f08e1c65e0dce2e63da3ca7295a8fcfc01019724bc9468d9d1338f3c2d879b4446980b5aa3e10441 SHA512 19aafd07aa6ebe3f05e321048480f746a9aafd1ad4e0323486db5c54035430f607e171d2246e91bbbf8a2a7e15278d793ad13d84e824df7af65345070483a696
AUX lvmlockd.initd-2.02.166-r1 393 BLAKE2B 83eb337aa1069e66d7746b23141da24717303552016497d29d4df304bb174b2c380cc7c09df7b3529e355cf172150c7cf254afb984a6561e1fa3459aeed43421 SHA512 11d6f186799d8628220eccb4823e5bd251bc3c447e6c3f8a63c025dc4e08e0a7638a8439967ea2ee8a717264887597be4992afca59571ebaa651441782288081
DIST LVM2.2.02.177.tgz 2378651 BLAKE2B f68153b916c51e1f43fa24c954270e5bac6b7df5cf1699d800a508cd4c1bc90a7b9a8b9b6614f84d36eca88cefef759dd3a724b0894d16dcbd81805f2955018e SHA512 e287aeae3ce5ce0efcdebce90f24c2f659cd8691839e3f3cb902848535259ae510ec48f5355481b99f7285d9cff01883e6ef2b101072bdf9c99fba8e9cb54ded
EBUILD lvm2-2.02.177.ebuild 9995 BLAKE2B ed3692bc64c771ad4f2f0f7c9ea0998a4e931dbd31da0650528a66ef001356c4e90800170478db0a956bbb5f3131ce7fbdcb4b2d98001a770955b841834f8a0f SHA512 b7d10a5e6f403ceb1557efe5033ddb9583f6fba5c334ab476dba95ebe73c8b7034cb03fe441ded0925d439e0b6b56fd055afe04c180773deb4d690a22f543381
MISC metadata.xml 1397 BLAKE2B fb780193c777b248648d09cc4c0f287f07b64df79912a4c1c37b5c456f8fc8ea98470c03501619432bddb5df1e3f877178a0c7e630b295a01a3bfc27fa63520e SHA512 1ed97dbef323b6703097c20de99e9003c88663a887bcf87c9489baddfa180aa3d8645e4e60cd3eb3b9505603997ac3ab98a7ee96a813b77b9dc25862dd332d35

View File

@ -0,0 +1,9 @@
# CLVMD_CLUSTER_TIMEOUT -- amount of time to wait for cluster quorum.
CLVMD_CLUSTER_TIMEOUT=30
# CLVMD_NODES_TIMEOUT -- amount of time to wait for the other nodes to
# join the cluster.
CLVMD_NODES_TIMEOUT=60

View File

@ -0,0 +1,145 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
[ -x /usr/sbin/clvmd ] && CLVMD_BIN="/usr/sbin/clvmd" || CLVMD_BIN="/sbin/clvmd"
[ -z "$CLVMD_CLUSTER_TIMEOUT" ] && CLVMD_CLUSTER_TIMEOUT=30
[ -n "$CLVMD_NODES_TIMEOUT" ] || CLVMD_NODES_TIMEOUT=60
VGCHANGE="/sbin/vgchange"
VGSCAN="/sbin/vgscan"
VGDISPLAY="/sbin/vgdisplay"
CLVMD_PIDFILE="/var/run/clvmd.pid"
depend() {
use net dns logger dmeventd
want cman corosync openais
}
load_modules() {
local module modules
modules=$1
for module in ${modules}; do
ebegin "Loading ${module} kernel module"
modprobe ${module}
eend $? "Failed to load ${module} kernel module"
done
}
unload_modules() {
local module modules
modules=$1
for module in ${modules}; do
ebegin "Unloading ${module} kernel module"
modprobe -r ${module}
eend $? "Failed to unload ${module} kernel module"
done
}
umount_gfs_filesystems() {
local sig retry
local remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"
if [ -n "${remaining}" ]
then
sig=
retry=3
while [ -n "${remaining}" -a "${retry}" -gt 0 ]
do
if [ "${retry}" -lt 3 ]
then
ebegin "Unmounting GFS filesystems (retry)"
umount ${remaining} &>/dev/null
eend $? "Failed to unmount GFS filesystems this retry"
else
ebegin "Unmounting GFS filesystems"
umount ${remaining} &>/dev/null
eend $? "Failed to unmount GFS filesystems"
fi
remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)"
[ -z "${remaining}" ] && break
/bin/fuser -k -m ${sig} ${remaining} &>/dev/null
sleep 5
retry=$((${retry} -1))
sig=-9
done
fi
}
start_volumes() {
ebegin "Scanning LVM volumes"
$VGSCAN > /dev/null 2>&1
eend $?
ret=$?
if [ "$ret" -eq 5 ]
then
einfo " Waiting for other nodes to join the cluster ($CLVMD_NODES_TIMEOUT seconds)"
fi
clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'`
for vg in $clustervgs; do
ebegin " Activating Clustered VG: ${vg} "
wait=0
while [ -n "$($VGCHANGE -a y ${vg} 2>&1 |grep "clvmd not running")" ]; do
if [ $wait -lt $CLVMD_NODES_TIMEOUT ]; then
sleep 3
wait=$(($wait + 3))
else
eend 1
fi
done
eend 0
done
}
stop_volumes() {
# Deactivate only clustered volumes
clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'`
for vg in $clustervgs; do
ebegin " Shutting Down Clustered VG: ${vg} "
$VGCHANGE -anl ${vg} >/dev/null
eend $?
done
}
start() {
local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/{modules,devices})
if [ -z "${module}" ]; then
load_modules "dm-mod"
sleep 1s
fi
ebegin "Starting clvmd ($CLVMD_CLUSTER_TIMEOUT seconds)"
start-stop-daemon --start --quiet --exec ${CLVMD_BIN} -- -T ${CLVMD_CLUSTER_TIMEOUT}
eend $?
start_volumes
}
stop() {
# umount GFS filesystems
umount_gfs_filesystems
#stop_volumes
ebegin "Stopping clvmd"
#start-stop-daemon --stop -s TERM --quiet --exec ${CLVMD_BIN} --name clvmd
killall -TERM ${CLVMD_BIN} >/dev/null
eend $?
#local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/modules)
#if [[ "$?" -eq 0 && ! -z "${module}" ]]; then
# unload_modules "dm-mod"
#fi
}

View File

@ -0,0 +1 @@
RC_AFTER="lvm"

View File

@ -0,0 +1,146 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
# As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that
# means dmeventd is NOT notified, as it cannot be safely running
before dmeventd checkfs fsck
after modules
}
dm_in_proc() {
local retval=0
for x in devices misc ; do
grep -qs 'device-mapper' /proc/${x}
retval=$((${retval} + $?))
done
return ${retval}
}
# char **build_dmsetup_command(volume)
#
# Returns complete dmsetup command given single volume name
build_dmsetup_command() {
local count dmsetup_cmd
# Number of lines mentioning volume name
count=$(grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | grep -c ${1})
# If there's just one line:
if [ ${count} -eq 1 ] ; then
echo "echo $(grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \
grep ${1} | awk '{$1=""; print $0}') | /sbin/dmsetup create ${1}"
# For all cases with more lines:
elif [ ${count} -gt 1 ] ; then
for c in $( seq 1 ${count} ) ; do
if [ ${c} -eq 1 ] ; then
# Heavy escaping in awk-statement because we cannot use apostrophes
dmsetup_cmd="echo -e $(grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \
grep ${1} | awk NR==${c}\ \{\$1=\"\"\;\ print\ \$0\})"
else
# Append starting with newline
dmsetup_cmd="${dmsetup_cmd}\\\\n \
$(grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \
grep ${1} | awk NR==${c}\ \{\$1=\"\"\;\ print\ \$0\})"
fi
done
echo "${dmsetup_cmd} | /sbin/dmsetup create ${1}"
fi
return 0
}
# char **get_new_dm_volumes(void)
#
# Return unique volumes from /etc/dmtab
get_new_dm_volumes() {
local volume
# Filter comments and blank lines
grep -v -e '^[[:space:]]*\(#\|$\)' /etc/dmtab | \
awk '{ print $1 }' | \
uniq | \
while read volume ; do
# If it exists, skip it
dmvolume_exists "${volume%:}" && continue
echo "${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
/sbin/dmsetup ls 2>/dev/null | \
while read line ; do
for x in ${line} ; do
# the following conditonal return only breaks out
# of the while loop, as it is running in a pipe.
[ "${x}" = "${volume}" ] && return 1
# We only want to check the volume name
break
done
done
# if 1 was returned from the above loop, then indicate that
# volume exists
[ $? = 1 ] && return 0
# otherwise the loop exited normally and the volume does not
# exist
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
set -- $(/sbin/dmsetup table 2>/dev/null | grep -e "^${volume}:")
[ "${volume}" = "$1" -a -z "$2" ]
}
start() {
if [ -e /proc/modules ] && ! dm_in_proc ; then
modprobe dm-mod 2>/dev/null
fi
# Ensure the dirs exist for locking and running
checkpath -q -d -m 0700 -o root:root /run/lvm /run/lock/lvm
local x volume
if [ -x /sbin/dmsetup -a -c /dev/mapper/control -a -f /etc/dmtab ] ; then
[ -n "$(get_new_dm_volumes)" ] && \
einfo " Setting up device-mapper volumes:"
get_new_dm_volumes | \
while read x ; do
[ -n "${x}" ] || continue
volume="${x##* }"
ebegin " Creating volume: ${volume}"
if ! eval $(build_dmsetup_command ${volume}) >/dev/null 2>/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}" 2>/dev/null
else
eend 0
fi
done
fi
}

View File

@ -0,0 +1,25 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
PIDFILE=/run/dmeventd.pid
BIN=/sbin/dmeventd
depend() {
# As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that
# means dmeventd is NOT notified, as it cannot be safely running
after lvm device-mapper
}
start() {
ebegin "Starting dmeventd"
start-stop-daemon --start --exec $BIN --pidfile $PIDFILE
eend $?
}
stop() {
ebegin "Stopping dmeventd"
start-stop-daemon --stop --exec $BIN --pidfile $PIDFILE
eend $?
}

11
sys-fs/lvm2/files/dmtab Normal file
View File

@ -0,0 +1,11 @@
#/etc/dmraid: config file for adding device-mapper volumes at boot
# 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.

View File

@ -0,0 +1,38 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# This script is based on upstream file
# LVM2.2.02.67/scripts/lvm2_monitoring_init_red_hat.in
depend() {
# As of .67-r1, we call ALL lvm start/stop scripts with --sysinit, that
# means dmeventd is NOT notified, as it cannot be safely running
need lvm dmeventd
}
VGCHANGE=/sbin/vgchange
VGS=/sbin/vgs
start() {
ret=0
# TODO do we want to separate out already active groups only?
VGSLIST=`$VGS --noheadings -o name --rows 2> /dev/null`
ebegin "Starting LVM monitoring for VGs ${VGSLIST}:"
$VGCHANGE --monitor y --poll y ${VGSLIST}
ret=$?
eend $ret
return $ret
}
stop() {
ret=0
# TODO do we want to separate out already active groups only?
VGSLIST=`$VGS --noheadings -o name --rows 2> /dev/null`
ebegin "Stopping LVM monitoring for VGs ${VGSLIST}:"
$VGCHANGE --monitor n ${VGSLIST}
ret=$?
eend $ret
return $ret
}

View File

@ -0,0 +1,5 @@
# LVM should normally only be started after mdraid is available
# this is because LVM physical volumes are very often MD devices.
RC_AFTER="mdraid"
# vim: ft=gentoo-conf-d

View File

@ -0,0 +1,145 @@
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
_get_lvm_path() {
local lvm_path=
for lvm_path in /bin/lvm /sbin/lvm ; do
[ -x "$lvm_path" ] && break
done
echo "${lvm_path}"
}
_need_lvmetad()
{
local lvm_path="$(_get_lvm_path)"
[ ! -x "${lvm_path}" ] && return 1
${lvm_path} dumpconfig global 2>/dev/null | grep -q 'use_lvmetad=1'
}
_need_lvmlockd()
{
local lvm_path="$(_get_lvm_path)"
[ ! -x "${lvm_path}" ] && return 1
${lvm_path} dumpconfig global 2>/dev/null | grep -q 'use_lvmlockd=1'
}
depend() {
before checkfs fsck
after modules device-mapper
# We may use lvmetad based on the configuration. If we added lvmetad
# support while lvm2 is running then we aren't dependent on it. For the
# more common case, if its disabled in the config we aren't dependent
# on it.
config /etc/lvm/lvm.conf
local _need=
if service_started; then
_need=$(service_get_value need)
else
if _need_lvmetad; then
_need="${_need} lvmetad"
fi
if _need_lvmlockd; then
_need="${_need} lvmlockd"
fi
fi
need sysfs ${_need}
}
config='global { locking_dir = "/run/lock/lvm" }'
dm_in_proc() {
local retval=0
for x in devices misc ; do
grep -qs 'device-mapper' /proc/${x}
retval=$((${retval} + $?))
done
return ${retval}
}
start() {
# LVM support for /usr, /home, /opt ....
# This should be done *before* checking local
# volumes, or they never get checked.
# NOTE: Add needed modules for LVM or RAID, etc
# to /etc/modules.autoload if needed
lvm_path="$(_get_lvm_path)"
for lvm_path in /bin/lvm /sbin/lvm ; do
[ -x "$lvm_path" ] && break
done
if [ ! -x "$lvm_path" ]; then
eerror "Cannot find lvm binary in /sbin or /bin!"
return 1
fi
if [ -z "${CDBOOT}" ] ; then
if [ -e /proc/modules ] && ! dm_in_proc ; then
modprobe dm-mod 2>/dev/null
fi
if [ -d /proc/lvm ] || dm_in_proc ; then
ebegin "Setting up the Logical Volume Manager"
#still echo stderr for debugging
lvm_commands="#!${lvm_path}\n"
# Extra PV find pass because some devices might not have been available until very recently
lvm_commands="${lvm_commands}pvscan --config '${config}'\n"
# Now make the nodes
lvm_commands="${lvm_commands}vgscan --config '${config}' --mknodes\n"
# And turn them on!
lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ly\n"
if _need_lvmlockd; then
# Start lockd VGs as required
lvm_commands="${lvm_commands}vgchange --config '${config}' --lock-start --lock-opt auto\n"
fi
# Order of this is important, have to work around dash and LVM readline
printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 >/dev/null
eend $? "Failed to setup the LVM"
fi
fi
}
start_post()
{
# Save if we needed lvmetad
if _need_lvmetad; then
service_set_value need lvmetad
fi
}
stop() {
for lvm_path in /bin/lvm /sbin/lvm ; do
[ -x "$lvm_path" ] && break
done
if [ ! -x "$lvm_path" ]; then
eerror "Cannot find lvm binary in /sbin or /bin!"
return 1
fi
# Stop LVM2
if [ -x /sbin/vgs ] && \
[ -x /sbin/vgchange ] && \
[ -x /sbin/lvchange ] && \
[ -f /etc/lvmtab -o -d /etc/lvm ] && \
[ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ]
then
einfo "Shutting down the Logical Volume Manager"
VGS=$($lvm_path vgs --config "${config}" -o vg_name --noheadings --nosuffix --rows 2> /dev/null)
if [ "$VGS" ]
then
ebegin " Shutting Down LVs & VGs"
#still echo stderr for debugging
lvm_commands="#!${lvm_path}\n"
# Extra PV find pass because some devices might not have been available until very recently
lvm_commands="${lvm_commands}lvchange --config '${config}' --sysinit -a ln ${VGS}\n"
# Now make the nodes
lvm_commands="${lvm_commands}vgchange --config '${config}' --sysinit -a ln ${VGS}\n"
# Order of this is important, have to work around dash and LVM readline
printf "%b\n" "${lvm_commands}" | $lvm_path /proc/self/fd/0 --config "${config}" >/dev/null
eend $? "Failed (possibly some LVs still needed for /usr or root)"
fi
einfo "Finished shutting down the Logical Volume Manager"
return 0
fi
}
# vim:ts=4

View File

@ -0,0 +1,52 @@
Maintainer note: Forward ported without editing from lvm2-2.02.108-example.conf.in.patch to apply cleanly.
--- LVM2.2.02.129/conf/example.conf.in
+++ LVM2.2.02.129/conf/example.conf.in
@@ -128,6 +128,9 @@
# Example
# Accept every block device:
# filter = [ "a|.*/|" ]
+ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel
+ # noise when you probed while not available.
+ filter = [ "r|/dev/nbd.*|", "a/.*/" ]
# Reject the cdrom drive:
# filter = [ "r|/dev/cdrom|" ]
# Work with just loopback devices, e.g. for testing:
@@ -620,7 +623,8 @@
# tools need to be installed with .lvm1 suffices, e.g. vgscan.lvm1.
# They will stop working once the lvm2 on-disk metadata format is used.
# This configuration option has an automatic default value.
- # fallback_to_lvm1 = @DEFAULT_FALLBACK_TO_LVM1@
+ # Gentoo: the LVM tools are a seperate package.
+ fallback_to_lvm1 = 0
# Configuration option global/format.
# The default metadata format that commands should use.
@@ -1413,7 +1417,7 @@
# Configuration section metadata.
# This configuration section has an automatic default value.
-# metadata {
+metadata {
# Configuration option metadata/pvmetadatacopies.
# Number of copies of metadata to store on each PV.
@@ -1431,7 +1435,8 @@
#
# This configuration option is advanced.
# This configuration option has an automatic default value.
- # pvmetadatacopies = 1
+ # Gentoo: enable for data safety, but PV resize is then disabled.
+ # pvmetadatacopies = 2
# Configuration option metadata/vgmetadatacopies.
# Number of copies of metadata to maintain for each VG.
@@ -1486,7 +1491,7 @@
#
# This configuration option is advanced.
# This configuration option does not have a default value defined.
-# }
+}
# Configuration section report.
# LVM report command output formatting.

View File

@ -0,0 +1,12 @@
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -505,7 +505,9 @@
dev->flags |= DEV_NOT_O_NOATIME;
if ((dev->fd = open(name, flags, 0777)) >= 0) {
log_debug_devs("%s: Not using O_NOATIME", name);
+#ifdef O_DIRECT_SUPPORT
goto opened;
+#endif
}
}
#endif

View File

@ -0,0 +1,29 @@
--- LVM2.2.02.176/libdm/libdevmapper.pc.in
+++ LVM2.2.02.176/libdm/libdevmapper.pc.in
@@ -9,4 +9,4 @@
Cflags: -I${includedir}
Libs: -L${libdir} -ldevmapper
Requires.private: @SELINUX_PC@ @UDEV_PC@
-Libs.private: -lm @RT_LIBS@
+Libs.private: -lm @RT_LIBS@ @PTHREAD_LIBS@
--- LVM2.2.02.176/tools/Makefile.in
+++ LVM2.2.02.176/tools/Makefile.in
@@ -93,6 +93,7 @@
INSTALL_LVM_TARGETS += install_tools_static
INSTALL_DMSETUP_TARGETS += install_dmsetup_static
INSTALL_CMDLIB_TARGETS += install_cmdlib_static
+ STATIC_LIBS += @PTHREAD_LIBS@
endif
LVMLIBS = $(LVMINTERNAL_LIBS) -ldevmapper
@@ -118,6 +119,10 @@
include $(top_builddir)/make.tmpl
+ifeq ("@STATIC_LINK@", "yes")
+ STATIC_LIBS += @PTHREAD_LIBS@
+endif
+
device-mapper: $(TARGETS_DM)
CFLAGS_dmsetup.o += $(UDEV_CFLAGS) $(EXTRA_EXEC_CFLAGS)

View File

@ -0,0 +1,29 @@
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3110,7 +3110,7 @@ static int _check_standard_fds(void)
int err = is_valid_fd(STDERR_FILENO);
if (!is_valid_fd(STDIN_FILENO) &&
- !(stdin = fopen(_PATH_DEVNULL, "r"))) {
+ !freopen(_PATH_DEVNULL, "r", stdin)) {
if (err)
perror("stdin stream open");
else
@@ -3120,7 +3120,7 @@ static int _check_standard_fds(void)
}
if (!is_valid_fd(STDOUT_FILENO) &&
- !(stdout = fopen(_PATH_DEVNULL, "w"))) {
+ !freopen(_PATH_DEVNULL, "r", stdout)) {
if (err)
perror("stdout stream open");
/* else no stdout */
@@ -3128,7 +3128,7 @@ static int _check_standard_fds(void)
}
if (!is_valid_fd(STDERR_FILENO) &&
- !(stderr = fopen(_PATH_DEVNULL, "w"))) {
+ !freopen(_PATH_DEVNULL, "w", stderr)) {
printf("stderr stream open: %s\n",
strerror(errno));
return 0;

View File

@ -0,0 +1,24 @@
diff --git a/lib/log/log.c b/lib/log/log.c
index 79fbd7a..0999d10 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -161,6 +161,7 @@ static void _check_and_replace_standard_log_streams(FILE *old_stream, FILE *new_
* Close and reopen standard stream on file descriptor fd.
*/
int reopen_standard_stream(FILE **stream, const char *mode)
+#ifdef __GLIBC__
{
int fd, fd_copy, new_fd;
const char *name;
@@ -207,6 +208,11 @@ int reopen_standard_stream(FILE **stream, const char *mode)
*stream = new_stream;
return 1;
}
+#else
+{
+ return (freopen(NULL, mode, *stream) != NULL);
+}
+#endif
void init_log_fn(lvm2_log_fn_t log_fn)
{

View File

@ -0,0 +1,21 @@
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -159,7 +159,7 @@ static void _touch_memory(void *mem, siz
static void _allocate_memory(void)
{
-#ifndef VALGRIND_POOL
+#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
void *stack_mem;
struct rlimit limit;
int i, area = 0, missing = _size_malloc_tmp, max_areas = 32, hblks;
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -18,6 +18,7 @@
#include "daemon-server.h"
#include "daemon-log.h"
+#include <fcntl.h>
#include <dlfcn.h>
#include <errno.h>
#include <pthread.h>

View File

@ -0,0 +1,72 @@
--- LVM2.2.02.56/scripts/lvm2create_initrd/lvm2create_initrd.orig 2006-11-21 22:41:56.000000000 +0000
+++ LVM2.2.02.56/scripts/lvm2create_initrd/lvm2create_initrd 2009-12-26 01:47:08.025224602 +0000
@@ -54,7 +54,9 @@
DEVRAM=/tmp/initrd.$$
# set defaults
-BINFILES=${BINFILES:-"`which lvm` `which bash` `which busybox` `which pivot_root`"}
+LVM=`which lvm.static`
+LVM=${LVM:-"`which lvm`"}
+BINFILES=${BINFILES:-"${LVM} `which bash` `which busybox` `which pivot_root`"}
BASICDEVICES=${BASICDEVICES:-"std consoleonly fd"}
BLOCKDEVICES=${BLOCKDEVICES:-"md hda hdb hdc hdd sda sdb sdc sdd"}
MAKEDEV=${MAKEDEV:-"debian"}
@@ -119,6 +121,10 @@
echo "$PRE Mounting /proc"
mount -t proc none /proc
+# We need /sys for lvm
+echo "$PRE Mounting /sys"
+mount -t sysfs sysfs /sys
+
# plug in modules listed in /etc/modules
if [ -f /etc/modules ]; then
echo -n "$PRE plugging in kernel modules:"
@@ -179,26 +185,29 @@
# run a shell if we're passed lvm2rescue on commandline
grep lvm2rescue /proc/cmdline 1>/dev/null 2>&1
if [ $? -eq 0 ]; then
- lvm vgchange --ignorelockingfailure -P -a y
+ $LVM vgchange --ignorelockingfailure -P -a y
do_shell
else
- lvm vgchange --ignorelockingfailure -a y
+ $LVM vgchange --ignorelockingfailure -a y
fi
echo "$PRE Mounting root filesystem $rootvol ro"
mkdir /rootvol
if ! mount -t auto -o ro $rootvol /rootvol; then
- echo "\t*FAILED*";
+ echo "\t*FAILED TRYING TO MOUNT ROOTVOL*";
do_shell
fi
echo "$PRE Umounting /proc"
umount /proc
+echo "$PRE Umounting /sys"
+umount /sys
+
echo "$PRE Changing roots"
cd /rootvol
if ! pivot_root . initrd ; then
- echo "\t*FAILED*"
+ echo "\t*FAILED PIVOT TO NEW ROOT*"
do_shell
fi
@@ -356,7 +365,7 @@
fi
verbose "creating basic set of directories in $TMPMNT"
-(cd $TMPMNT; mkdir bin dev etc lib proc sbin var)
+(cd $TMPMNT; mkdir bin dev etc lib proc sbin sys var)
if [ $? -ne 0 ]; then
echo "$cmd -- ERROR creating directories in $TMPMNT"
cleanup 1
@@ -499,4 +508,3 @@
FINALTXT
cleanup 0
-

View File

@ -0,0 +1,42 @@
diff -Nuar --exclude '*~' LVM2.2.02.63.orig/daemons/dmeventd/Makefile.in LVM2.2.02.63/daemons/dmeventd/Makefile.in
--- LVM2.2.02.63.orig/daemons/dmeventd/Makefile.in 2010-04-09 14:42:48.000000000 -0700
+++ LVM2.2.02.63/daemons/dmeventd/Makefile.in 2010-04-19 11:53:27.000000000 -0700
@@ -28,11 +28,12 @@
INSTALL_LIB_TARGETS = install_lib_dynamic
LIB_NAME = libdevmapper-event
+LIB_STATIC = $(LIB_NAME).a
+INSTALL_LIB_TARGETS += install_lib_static
+TARGETS += $(LIB_STATIC)
ifeq ("@STATIC_LINK@", "yes")
- LIB_STATIC = $(LIB_NAME).a
- TARGETS += $(LIB_STATIC) dmeventd.static
+ TARGETS += dmeventd.static
INSTALL_DMEVENTD_TARGETS += install_dmeventd_static
- INSTALL_LIB_TARGETS += install_lib_static
endif
LIB_VERSION = $(LIB_VERSION_DM)
diff -Nuar --exclude '*~' LVM2.2.02.63.orig/libdm/Makefile.in LVM2.2.02.63/libdm/Makefile.in
--- LVM2.2.02.63.orig/libdm/Makefile.in 2010-04-09 14:42:51.000000000 -0700
+++ LVM2.2.02.63/libdm/Makefile.in 2010-04-19 11:52:20.000000000 -0700
@@ -34,8 +34,8 @@
INCLUDES = -I$(srcdir)/$(interface) -I$(srcdir)
-ifeq ("@STATIC_LINK@", "yes")
LIB_STATIC = $(interface)/libdevmapper.a
+ifeq ("@STATIC_LINK@", "yes")
endif
LIB_SHARED = $(interface)/libdevmapper.$(LIB_SUFFIX)
@@ -63,8 +63,8 @@
INSTALL_TYPE = install_dynamic
-ifeq ("@STATIC_LINK@", "yes")
INSTALL_TYPE += install_static
+ifeq ("@STATIC_LINK@", "yes")
endif
ifeq ("@PKGCONFIG@", "yes")

View File

@ -0,0 +1,18 @@
X-Gentoo-Bug-URL: http://bugs.gentoo.org/show_bug.cgi?id=301331
X-Gentoo-Bug: 301331
diff -Nuar LVM2.2.02.67.orig/scripts/lvm2create_initrd/lvm2create_initrd LVM2.2.02.67/scripts/lvm2create_initrd/lvm2create_initrd
--- LVM2.2.02.67.orig/scripts/lvm2create_initrd/lvm2create_initrd 2010-06-07 18:44:34.182980475 +0000
+++ LVM2.2.02.67/scripts/lvm2create_initrd/lvm2create_initrd 2010-06-07 18:51:27.636312899 +0000
@@ -469,9 +469,9 @@
rmdir $TMPMNT/lost+found
echo "$cmd -- ummounting ram disk"
-umount $DEVRAM
+umount $TMPMNT
if [ $? -ne 0 ]; then
- echo "$cmd -- ERROR umounting $DEVRAM"
+ echo "$cmd -- ERROR umounting $TMPMNT"
cleanup 1
fi

View File

@ -0,0 +1,11 @@
--- LVM2/make.tmpl.in
+++ LVM2/make.tmpl.in
@@ -395,7 +395,7 @@
( cat $(srcdir)/.exported_symbols; \
if test x$(EXPORTED_HEADER) != x; then \
$(CC) -E -P $(INCLUDES) $(DEFS) $(EXPORTED_HEADER) | \
- $(SED) -ne "/^typedef|}/!s/.*[ *]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
+ LC_ALL=C $(SED) -ne "/^typedef|}/!s/.*[ *]\($(EXPORTED_FN_PREFIX)_[a-z0-9_]*\)(.*/\1/p"; \
fi \
) > $@

View File

@ -0,0 +1,13 @@
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index 0365797..a4684b4 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -2148,7 +2148,7 @@ int lockd_lv_name(struct cmd_context *cmd, struct volume_group *vg,
static int _lockd_lv_thin(struct cmd_context *cmd, struct logical_volume *lv,
const char *def_mode, uint32_t flags)
{
- struct logical_volume *pool_lv;
+ struct logical_volume *pool_lv = NULL;
if (lv_is_thin_volume(lv)) {
struct lv_segment *pool_seg = first_seg(lv);

View File

@ -0,0 +1,25 @@
lib/filters/filter-persistent.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/filters/filter-persistent.c b/lib/filters/filter-persistent.c
index 5bc0861..203c88e 100644
--- a/lib/filters/filter-persistent.c
+++ b/lib/filters/filter-persistent.c
@@ -26,12 +26,15 @@ struct pfilter {
struct dev_types *dt;
};
+static char* _good_device = "good";
+static char* _bad_device = "bad";
+
/*
* The hash table holds one of these two states
* against each entry.
*/
-#define PF_BAD_DEVICE ((void *) 1)
-#define PF_GOOD_DEVICE ((void *) 2)
+#define PF_BAD_DEVICE ((void *) &_good_device)
+#define PF_GOOD_DEVICE ((void *) &_bad_device)
static int _init_hash(struct pfilter *pf)
{

View File

@ -0,0 +1,16 @@
scripts/lvm2_lvmetad_systemd_red_hat.service.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.service.in b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
index 8f4c60d..a1cedd2 100644
--- a/scripts/lvm2_lvmetad_systemd_red_hat.service.in
+++ b/scripts/lvm2_lvmetad_systemd_red_hat.service.in
@@ -9,7 +9,7 @@ Conflicts=shutdown.target
[Service]
Type=simple
NonBlocking=true
-ExecStart=@SBINDIR@/lvmetad -f
+ExecStart=@SBINDIR@/lvmetad -f -t 3600
Environment=SD_ACTIVATION=1
Restart=on-abort
PIDFile=@LVMETAD_PIDFILE@

View File

@ -0,0 +1,30 @@
conf/example.conf.in | 2 +-
lib/config/config_settings.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index c0afcb7..ec12918 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -106,7 +106,7 @@ devices {
# Example
# preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
#
- # This configuration option does not have a default value defined.
+ preferred_names = [ "^/dev/mpath/", "^/dev/mapper/mpath", "^/dev/[hs]d" ]
# Configuration option devices/filter.
# Limit the block devices that are used by LVM commands.
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 9017043..c06b6f0 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -205,7 +205,7 @@ cfg(devices_external_device_info_source_CFG, "external_device_info_source", devi
" compiled with udev support.\n"
"#\n")
-cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED , CFG_TYPE_STRING, NULL, vsn(1, 2, 19), NULL, 0, NULL,
+cfg_array(devices_preferred_names_CFG, "preferred_names", devices_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, "#S^/dev/mpath/#S^/dev/mapper/mpath#S^/dev/[hs]d", vsn(1, 2, 19), NULL, 0, NULL,
"Select which path name to display for a block device.\n"
"If multiple path names exist for a block device, and LVM needs to\n"
"display a name for the device, the path names are matched against\n"

View File

@ -0,0 +1,12 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
pidfile="/run/lvmetad.pid"
command="/sbin/lvmetad"
command_args="${LVMETAD_OPTS:=-p ${pidfile}}"
start_stop_daemon_args="--pidfile ${pidfile}"
depend() {
:
}

View File

@ -0,0 +1,17 @@
#!/sbin/openrc-run
# Copyright 1999-2016 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
pidfile="/run/lvmetad.pid"
command="/sbin/lvmetad"
command_args="${LVMETAD_OPTS:=-p ${pidfile}}"
start_stop_daemon_args="--pidfile ${pidfile}"
depend() {
:
}
start_pre()
{
checkpath --directory /run/lvm || return 1
}

View File

@ -0,0 +1,17 @@
#!/sbin/openrc-run
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
pidfile="/run/lvmlockd.pid"
command="/sbin/lvmlockd"
command_args="${LVMLOCKD_OPTS:--p ${pidfile}} ${LVMLOCKD_TYPE:--g sanlock}"
start_stop_daemon_args="--pidfile ${pidfile}"
depend() {
before sanlock
}
start_pre()
{
checkpath --directory /run/lvm || return 1
}

View File

@ -0,0 +1,303 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit autotools eutils linux-info multilib systemd toolchain-funcs udev flag-o-matic
DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
HOMEPAGE="https://sourceware.org/lvm2/"
SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
ftp://sourceware.org/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
IUSE="readline static static-libs systemd clvm cman corosync lvm1 lvm2create_initrd openais sanlock selinux +udev +thin device-mapper-only"
REQUIRED_USE="device-mapper-only? ( !clvm !cman !corosync !lvm1 !lvm2create_initrd !openais !sanlock !thin )
systemd? ( udev )
clvm? ( !systemd )"
DEPEND_COMMON="
clvm? (
cman? ( =sys-cluster/cman-3* )
corosync? ( sys-cluster/corosync )
openais? ( sys-cluster/openais )
=sys-cluster/libdlm-3*
)
readline? ( sys-libs/readline:0= )
sanlock? ( sys-cluster/sanlock )
systemd? ( >=sys-apps/systemd-205:0= )
udev? ( >=virtual/libudev-208:=[static-libs?] )"
# /run is now required for locking during early boot. /var cannot be assumed to
# be available -- thus, pull in recent enough baselayout for /run.
# This version of LVM is incompatible with cryptsetup <1.1.2.
RDEPEND="${DEPEND_COMMON}
>=sys-apps/baselayout-2.2
!<sys-apps/openrc-0.11
!<sys-fs/cryptsetup-1.1.2
!!sys-fs/clvm
!!sys-fs/lvm-user
>=sys-apps/util-linux-2.16
lvm2create_initrd? ( sys-apps/makedev )
thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
# USE 'static' currently only works with eudev, bug 520450
DEPEND="${DEPEND_COMMON}
virtual/pkgconfig
>=sys-devel/binutils-2.20.1-r1
sys-devel/autoconf-archive
static? (
selinux? ( sys-libs/libselinux[static-libs] )
udev? ( >=sys-fs/eudev-3.1.2[static-libs] )
>=sys-apps/util-linux-2.16[static-libs]
)"
S=${WORKDIR}/${PN/lvm/LVM}.${PV}
PATCHES=(
# Gentoo specific modification(s):
"${FILESDIR}"/${PN}-2.02.129-example.conf.in.patch
# Musl fixes
"${FILESDIR}"/${PN}-2.02.183-fix-stdio-usage.patch
"${FILESDIR}"/${PN}-2.02.183-portability.patch
"${FILESDIR}"/${PN}-2.02.183-implement-libc-specific-reopen_stream.patch
# For upstream -- review and forward:
"${FILESDIR}"/${PN}-2.02.63-always-make-static-libdm.patch
"${FILESDIR}"/${PN}-2.02.56-lvm2create_initrd.patch
"${FILESDIR}"/${PN}-2.02.67-createinitrd.patch #301331
"${FILESDIR}"/${PN}-2.02.99-locale-muck.patch #330373
"${FILESDIR}"/${PN}-2.02.176-pthread-pkgconfig.patch #492450
"${FILESDIR}"/${PN}-2.02.166-HPPA-no-O_DIRECT.patch #657446
"${FILESDIR}"/${PN}-set-default-preferred_names.patch
"${FILESDIR}"/${PN}-lvmetad-timeout.patch
"${FILESDIR}"/${PN}-2_02_180-filter-use-valid-pointers.patch
"${FILESDIR}"/${PN}-2_02_178-lvmlockd-fix-uninitialized.patch
)
pkg_setup() {
local CONFIG_CHECK="~SYSVIPC"
if use udev; then
local WARNING_SYSVIPC="CONFIG_SYSVIPC:\tis not set (required for udev sync)\n"
if linux_config_exists; then
local uevent_helper_path=$(linux_chkconfig_string UEVENT_HELPER_PATH)
if [ -n "${uevent_helper_path}" ] && [ "${uevent_helper_path}" != '""' ]; then
ewarn "It's recommended to set an empty value to the following kernel config option:"
ewarn "CONFIG_UEVENT_HELPER_PATH=${uevent_helper_path}"
fi
fi
fi
check_extra_config
# 1. Genkernel no longer copies /sbin/lvm blindly.
if use static; then
elog "Warning, we no longer overwrite /sbin/lvm and /sbin/dmsetup with"
elog "their static versions. If you need the static binaries,"
elog "you must append .static to the filename!"
fi
}
src_prepare() {
default
sed -i \
-e "1iAR = $(tc-getAR)" \
-e "s:CC ?= @CC@:CC = $(tc-getCC):" \
make.tmpl.in || die #444082
sed -i -e '/FLAG/s:-O2::' configure{.in,} || die #480212
if use udev && ! use device-mapper-only; then
sed -i -e '/use_lvmetad =/s:0:1:' conf/example.conf.in || die #514196
elog "Notice that \"use_lvmetad\" setting is enabled with USE=\"udev\" in"
elog "/etc/lvm/lvm.conf, which will require restart of udev, lvm, and lvmetad"
elog "if it was previously disabled."
fi
sed -i -e "s:/usr/bin/true:$(type -P true):" scripts/blk_availability_systemd_red_hat.service.in || die #517514
# Without thin-privision-tools, there is nothing to install for target install_man7:
use thin || { sed -i -e '/^install_lvm2/s:install_man7::' man/Makefile.in || die; }
eautoreconf
}
src_configure() {
filter-flags -flto
local myconf=()
local buildmode
myconf+=( $(use_enable !device-mapper-only dmeventd) )
myconf+=( $(use_enable !device-mapper-only cmdlib) )
myconf+=( $(use_enable !device-mapper-only applib) )
myconf+=( $(use_enable !device-mapper-only fsadm) )
myconf+=( $(use_enable !device-mapper-only lvmetad) )
use device-mapper-only && myconf+=( --disable-udev-systemd-background-jobs )
# Most of this package does weird stuff.
# The build options are tristate, and --without is NOT supported
# options: 'none', 'internal', 'shared'
if use static; then
buildmode="internal"
# This only causes the .static versions to become available
myconf+=( --enable-static_link )
else
buildmode="shared"
fi
dmbuildmode=$(use !device-mapper-only && echo internal || echo none)
# dmeventd requires mirrors to be internal, and snapshot available
# so we cannot disable them
myconf+=( --with-mirrors=${dmbuildmode} )
myconf+=( --with-snapshots=${dmbuildmode} )
if use thin; then
myconf+=( --with-thin=internal --with-cache=internal )
local texec
for texec in check dump repair restore; do
myconf+=( --with-thin-${texec}="${EPREFIX}"/sbin/thin_${texec} )
myconf+=( --with-cache-${texec}="${EPREFIX}"/sbin/cache_${texec} )
done
else
myconf+=( --with-thin=none --with-cache=none )
fi
if use lvm1; then
myconf+=( --with-lvm1=${buildmode} )
else
myconf+=( --with-lvm1=none )
fi
# disable O_DIRECT support on hppa, breaks pv detection (#99532)
use hppa && myconf+=( --disable-o_direct )
if use clvm; then
myconf+=( --with-cluster=${buildmode} )
# 4-state! Make sure we get it right, per bug 210879
# Valid options are: none, cman, gulm, all
#
# 2009/02:
# gulm is removed now, now dual-state:
# cman, none
# all still exists, but is not needed
#
# 2009/07:
# TODO: add corosync and re-enable ALL
local clvmd=""
use cman && clvmd="cman"
#clvmd="${clvmd/cmangulm/all}"
use corosync && clvmd="${clvmd:+$clvmd,}corosync"
use openais && clvmd="${clvmd:+$clvmd,}openais"
[ -z "${clvmd}" ] && clvmd="none"
myconf+=( --with-clvmd=${clvmd} )
myconf+=( --with-pool=${buildmode} )
myconf+=( --enable-lvmlockd-dlm )
else
myconf+=( --with-clvmd=none --with-cluster=none )
fi
econf \
$(use_enable readline) \
$(use_enable selinux) \
--enable-pkgconfig \
--with-confdir="${EPREFIX}"/etc \
--exec-prefix="${EPREFIX}" \
--sbindir="${EPREFIX}/sbin" \
--with-staticdir="${EPREFIX}"/sbin \
--libdir="${EPREFIX}/$(get_libdir)" \
--with-usrlibdir="${EPREFIX}/usr/$(get_libdir)" \
--with-default-dm-run-dir=/run \
--with-default-run-dir=/run/lvm \
--with-default-locking-dir=/run/lock/lvm \
--with-default-pid-dir=/run \
$(use_enable udev udev_rules) \
$(use_enable udev udev_sync) \
$(use_with udev udevdir "$(get_udevdir)"/rules.d) \
$(use_enable sanlock lvmlockd-sanlock) \
$(use_enable systemd udev-systemd-background-jobs) \
--with-systemdsystemunitdir="$(systemd_get_systemunitdir)" \
${myconf[@]} \
CLDFLAGS="${LDFLAGS}"
}
src_compile() {
pushd include >/dev/null
emake
popd >/dev/null
if use device-mapper-only ; then
emake device-mapper
else
emake
emake CC="$(tc-getCC)" -C scripts lvm2_activation_generator_systemd_red_hat
fi
}
src_install() {
local inst
INSTALL_TARGETS="install install_tmpfiles_configuration"
# install systemd related files only when requested, bug #522430
use systemd && INSTALL_TARGETS="${INSTALL_TARGETS} install_systemd_units install_systemd_generators"
use device-mapper-only && INSTALL_TARGETS="install_device-mapper"
for inst in ${INSTALL_TARGETS}; do
emake DESTDIR="${D}" ${inst}
done
newinitd "${FILESDIR}"/device-mapper.rc-2.02.105-r2 device-mapper
newconfd "${FILESDIR}"/device-mapper.conf-1.02.22-r3 device-mapper
if use !device-mapper-only ; then
newinitd "${FILESDIR}"/dmeventd.initd-2.02.67-r1 dmeventd
newinitd "${FILESDIR}"/lvm.rc-2.02.172 lvm
newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm
newinitd "${FILESDIR}"/lvm-monitoring.initd-2.02.105-r2 lvm-monitoring
newinitd "${FILESDIR}"/lvmetad.initd-2.02.116-r3 lvmetad
fi
if use sanlock; then
newinitd "${FILESDIR}"/lvmlockd.initd-2.02.166-r1 lvmlockd
fi
if use clvm; then
newinitd "${FILESDIR}"/clvmd.rc-2.02.39 clvmd
newconfd "${FILESDIR}"/clvmd.confd-2.02.39 clvmd
fi
if use static-libs; then
dolib.a libdm/ioctl/libdevmapper.a
dolib.a libdaemon/client/libdaemonclient.a #462908
#gen_usr_ldscript libdevmapper.so
dolib.a daemons/dmeventd/libdevmapper-event.a
#gen_usr_ldscript libdevmapper-event.so
else
rm -f "${ED}"usr/$(get_libdir)/{libdevmapper-event,liblvm2cmd,liblvm2app,libdevmapper}.a
fi
if use lvm2create_initrd; then
dosbin scripts/lvm2create_initrd/lvm2create_initrd
doman scripts/lvm2create_initrd/lvm2create_initrd.8
newdoc scripts/lvm2create_initrd/README README.lvm2create_initrd
fi
insinto /etc
doins "${FILESDIR}"/dmtab
dodoc README VERSION* WHATS_NEW WHATS_NEW_DM doc/*.{c,txt} conf/*.conf
}
pkg_postinst() {
ewarn "Make sure the \"lvm\" init script is in the runlevels:"
ewarn "# rc-update add lvm boot"
ewarn
ewarn "Make sure to enable lvmetad in /etc/lvm/lvm.conf if you want"
ewarn "to enable lvm autoactivation and metadata caching."
}
src_test() {
einfo "Tests are disabled because of device-node mucking, if you want to"
einfo "run tests, compile the package and see ${S}/tests"
}

32
sys-fs/lvm2/metadata.xml Normal file
View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>robbat2@gentoo.org</email>
<name>Robin H. Johnson</name>
</maintainer>
<maintainer type="person">
<email>agk@redhat.com</email>
<name>Alasdair Kergon</name>
<description>Upstream Maintainer (please CC on bugs)</description>
</maintainer>
<maintainer type="person">
<email>cardoe@gentoo.org</email>
<name>Doug Goldstein</name>
<description>Backup to Robin. Please CC on bugs.</description>
</maintainer>
<use>
<flag name="clvm">Allow users to build clustered lvm2</flag>
<flag name="cman">Cman support for clustered lvm</flag>
<flag name="corosync">Corosync support for clustered lvm</flag>
<flag name="lvm1">Allow users to build lvm2 with lvm1 support</flag>
<flag name="lvm2create_initrd">Install lvm2create_initrd script and pull in <pkg>sys-apps/makedev</pkg> for the /sbin/MAKEDEV command</flag>
<flag name="openais">Openais support for clustered lvm</flag>
<flag name="thin">Support for thin volumes</flag>
<flag name="device-mapper-only">Build only device-mapper and not the rest of LVM2 (UNSUPPORTED)</flag>
<flag name="sanlock">Enable lvmlockd with support for sanlock</flag>
</use>
<upstream>
<remote-id type="cpe">cpe:/a:heinz_mauelshagen:lvm2</remote-id>
</upstream>
</pkgmetadata>