/usr/share/doc/bilibop-rules/examples/rlvm is in bilibop-rules 0.5.4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | #!/bin/bash
set -e
# rlvm: restricted lvm; allow the admin to run lvm commands in a safe way:
# - local PV and LV are filtered (hidden); there is no risk to modify them
# by mistake.
# - /etc/lvm/lvm.conf is not modified to filter local PV; there is no risk
# to compromise next boot process if the initramdisk is rebuild during the
# session.
[ -x /usr/share/bilibop/physical_volumes_filter ] || exit 9
pvfilter() { /usr/share/bilibop/physical_volumes_filter "$@"; }
export LVM_SYSTEM_DIR="/tmp/lvm2"
mkdir -p ${LVM_SYSTEM_DIR}
LVMCONF="${LVM_SYSTEM_DIR}/lvm.conf"
clear
cat <<EOF
rlvm (restricted lvm) allows you to run LVM commands in a safe way:
* Discard the risk to modify local PV and LV by filtering them.
* Discard the risk to compromise next boot by applying the PV filter
on a temporary file.
LVM_SYSTEM_DIR=${LVM_SYSTEM_DIR}
${LVMCONF}:
EOF
if [ -f "${LVMCONF}" ]; then
pvfilter
else
if [ -f "/etc/lvm/lvm.conf" ]; then
cp /etc/lvm/lvm.conf ${LVMCONF}
else
pvfilter --init
fi
pvfilter -obus -r bilibop
fi
echo
case "${1}" in
lvm)
exec lvm
;;
*)
export -f pvfilter
exec ${SHELL:-/bin/bash}
;;
esac
# vim: et sts=4 ts=4 sw=4
|