1 |
diff -Nur e-smith-grub-2.6.1.old/root/etc/e-smith/templates/etc/default/grub/GrubCmdLineLinux e-smith-grub-2.6.1/root/etc/e-smith/templates/etc/default/grub/GrubCmdLineLinux |
2 |
--- e-smith-grub-2.6.1.old/root/etc/e-smith/templates/etc/default/grub/GrubCmdLineLinux 2021-02-20 12:10:34.255000000 -0500 |
3 |
+++ e-smith-grub-2.6.1/root/etc/e-smith/templates/etc/default/grub/GrubCmdLineLinux 2021-02-20 12:12:07.926000000 -0500 |
4 |
@@ -1,12 +1,35 @@ |
5 |
{ |
6 |
- #GRUB_CMDLINE_LINUX="rd.lvm.lv=main/root rd.lvm.lv=main/swap rhgb quiet" |
7 |
- # to GRUB_CMDLINE_LINUX="rd.lvm.lv=main/root rd.lvm.lv=main/swap rhgb quiet rootflags=uquota,pquota" |
8 |
- # also remove noquota |
9 |
- @lines = map { |
10 |
- /^GRUB_CMDLINE_LINUX/ && s/noquota//; |
11 |
- /^GRUB_CMDLINE_LINUX/ && ! /rootflags=uquota,pquota/ && s/"$/ rootflags=uquota,pquota"/; |
12 |
- $_ |
13 |
- } @lines; |
14 |
+ # parse fstab to know what fstype is root partition |
15 |
+ my $fstype = "ext4"; |
16 |
+ my @patterns = ( qr/\s\/\s+xfs\s+/, qr/^\/dev\/main\/.*\s+xfs\s+/ ); |
17 |
+ open (RD, "</etc/fstab") |
18 |
+ || warn "Cannot open input file /etc/fstab: $!\n"; |
19 |
+ while (<RD>) |
20 |
+ { |
21 |
+ chop; |
22 |
+ $fstype="xfs" if ( $_ ~~ @patterns ); |
23 |
+ } |
24 |
+ close(RD); |
25 |
+ |
26 |
+ if ( $fstype eq "xfs" ) { |
27 |
+ # GRUB_CMDLINE_LINUX="rd.lvm.lv=main/root rd.lvm.lv=main/swap rhgb quiet" |
28 |
+ # to GRUB_CMDLINE_LINUX="rd.lvm.lv=main/root rd.lvm.lv=main/swap rhgb quiet rootflags=uquota,pquota" |
29 |
+ # also remove noquota |
30 |
+ @lines = map { |
31 |
+ /^GRUB_CMDLINE_LINUX/ && s/noquota//; |
32 |
+ /^GRUB_CMDLINE_LINUX/ && ! /rootflags=uquota,pquota/ && s/"$/ rootflags=uquota,pquota"/; |
33 |
+ $_ |
34 |
+ } @lines; |
35 |
+ } else { |
36 |
+ # if we are using ext[234] or any other fs type let's default to ... |
37 |
+ @lines = map { |
38 |
+ /^GRUB_CMDLINE_LINUX/ && s/noquota//; |
39 |
+ /^GRUB_CMDLINE_LINUX/ && /rootflags=uquota,pquota/ && s/rootflags=uquota,pquota//; |
40 |
+ $_ |
41 |
+ } @lines; |
42 |
+ |
43 |
+ |
44 |
+ } |
45 |
""; |
46 |
} |
47 |
|