diff --git a/rpm_spec/core-dom0-linux.spec.in b/rpm_spec/core-dom0-linux.spec.in index 900d3d40..cce5b39f 100644 --- a/rpm_spec/core-dom0-linux.spec.in +++ b/rpm_spec/core-dom0-linux.spec.in @@ -192,6 +192,28 @@ if [ $1 -ge 2 ]; then fi fi +# setup thinpool autoextend +if [ -e /etc/lvm/lvm.conf ]; then + tpool_threshold_line_value=$(grep -n -Po '^[^#]thin_pool_autoextend_threshold[ \t]*=[ \t]*\K\d+' /etc/lvm/lvm.conf) + if [ -n "$tpool_threshold_line_value" ]; then + tpool_threshold_line="$(echo "$tpool_threshold_line_value" | cut -d':' -f1)" + tpool_threshold_value="$(echo "$tpool_threshold_line_value" | cut -d':' -f2)" + + prev_line="$(sed -n "$((tpool_threshold_line-1))p" /etc/lvm/lvm.conf)" + qubes_comment='# QUBES OS: Custom value detected, not enforcing default. Recommended value: 90' + + if [ "$tpool_threshold_value" == 100 ]; then + sed -i 's|^\([^#]thin_pool_autoextend_threshold\)[ \t]*=.*|\1 = 90|' /etc/lvm/lvm.conf + + systemctl restart lvm2-monitor + else + if [ "$tpool_threshold_value" != 90 ] && [ "$prev_line" != "$qubes_comment" ]; then + sed -i "${tpool_threshold_line}i $qubes_comment" /etc/lvm/lvm.conf + fi + fi + fi +fi + %preun if [ "$1" = 0 ] ; then # no more packages left