File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,7 @@ if ! grep -q ^qubes: /etc/group ; then
179
179
fi
180
180
181
181
%post
182
+ set -eo pipefail
182
183
183
184
/usr/lib/qubes/patch-dnf-yum-config
184
185
@@ -192,6 +193,30 @@ if [ $1 -ge 2 ]; then
192
193
fi
193
194
fi
194
195
196
+ # setup thinpool autoextend
197
+ if [ -e /etc/lvm/lvm.conf ]; then
198
+ tpool_threshold_line_value=$(grep -n -Po '^[^#]thin_pool_autoextend_threshold[ \t]*=[ \t]*\K\d+' /etc/lvm/lvm.conf)
199
+ if [ -n "$tpool_threshold_line_value" ]; then
200
+ tpool_threshold_line="$(echo "$tpool_threshold_line_value" | cut -d':' -f1)"
201
+ tpool_threshold_value="$(echo "$tpool_threshold_line_value" | cut -d':' -f2)"
202
+
203
+ if [ -n "$tpool_threshold_line" ] && [ -n "$tpool_threshold_value" ]; then
204
+ prev_line="$(sed -n "$((tpool_threshold_line-1))p" /etc/lvm/lvm.conf)"
205
+ qubes_comment='# QUBES OS: Custom value detected, not enforcing default. Recommended value: 90'
206
+
207
+ if [ "$tpool_threshold_value" == 100 ]; then
208
+ sed -i 's|^\([^#]thin_pool_autoextend_threshold\)[ \t]*=.*|\1 = 90|' /etc/lvm/lvm.conf
209
+
210
+ systemctl restart lvm2-monitor
211
+ else
212
+ if [ "$tpool_threshold_value" != 90 ] && [ "$prev_line" != "$qubes_comment" ]; then
213
+ sed -i "${tpool_threshold_line}i $qubes_comment" /etc/lvm/lvm.conf
214
+ fi
215
+ fi
216
+ fi
217
+ fi
218
+ fi
219
+
195
220
%preun
196
221
if [ "$1" = 0 ] ; then
197
222
# no more packages left
You can’t perform that action at this time.
0 commit comments