summaryrefslogblamecommitdiff
path: root/user/lilo/partuuid.patch
blob: a1a4fcc10f1dfb2e59206949ef4a57f3440ef5ae (plain) (tree)































































                                                                                  
Enable usage of PARTUUID if /etc/fstab uses it for the root filesystem.
While we're here, make the generated labels for the kernel choices more
descriptive as well.

--- lilo-24.2/src/bsect.c	2011-06-22 02:09:44.000000000 -0500
+++ lilo-24.2/src/bsect.c	2020-03-19 07:59:59.819990912 -0500
@@ -1098,6 +1098,9 @@ if (image) { /* long section specific to
 	else if (strlen(root)>5 && !strncmp(root,"UUID=",5)) {
 	    sprintf(strchr(options,0),"root=%s ", root);
         }
+	else if (strlen(root)>9 && !strncmp(root,"PARTUUID=",9)) {
+	    sprintf(strchr(options,0),"root=%s ", root);
+        }
 	else {
 	    sprintf(strchr(options,0),"root=%x ",dev_number(root));
 	}
--- lilo-24.2/scripts/liloconfig	2015-11-21 18:00:21.000000000 -0600
+++ lilo-24.2/scripts/liloconfig	2020-03-19 14:36:22.710002318 -0500
@@ -217,11 +218,12 @@ sub convert_root_device {
 			$found = 0;
 		}
 	}
-	elsif ($rootpart =~ /^UUID/ or $rootpart =~ /^LABEL/) {
+	elsif ($rootpart =~ /^(PART)?UUID/ or $rootpart =~ /^LABEL/) {
 		$root_link = $rootpart;
 		$root_link =~ s{\"}{}g;
 		$root_link =~ s{^LABEL=}{/dev/disk/by-label/};
 		$root_link =~ s{^UUID=}{/dev/disk/by-uuid/};
+		$root_link =~ s{^PARTUUID=}{/dev/disk/by-partuuid/};
 
 		if (-l $root_link) {
 			$root_id = $rootpart;
@@ -610,6 +610,7 @@ sub write_image_config {
 	my $initrd2;
 	my $nr;
 	my $nr2;
+	my $label;
 
 	# append to new lilo.conf
 	open(MYFH_NEW, ">> $liloconfnew") or die "Cannot open file: $!";
@@ -627,18 +628,16 @@ sub write_image_config {
 		$initrd2 = $initrd;
 		$initrd2 =~ s/\.img//;
 		$nr2 = $nr + 1;
+		$label = $image;
+		$label =~ s@/boot/vmlinuz-@@;
+		$label =~ s/-[^-]*$//;
+		$label = substr $label, 0, 15;
 
 		print MYFH_NEW     'image = ' . $image . "\n";
 		if($opt_v) { print 'image = ' . $image . "\n"; }
 
-		if ($nr == 0) {
-			print MYFH_NEW     "\t"  . 'label = "Linux"' . "\n";
-			if($opt_v) { print "\t"  . 'label = "Linux"' . "\n"; }
-		}
-		elsif ($nr == 1) {
-			print MYFH_NEW     "\t"  . 'label = "Linux Old"' . "\n";
-			if($opt_v) { print "\t"  . 'label = "Linux Old"' . "\n"; }
-		}
+		print MYFH_NEW     "\t"  . "label = \"$label\"" . "\n";
+		if($opt_v) { print "\t"  . "label = \"$label\""  . "\n"; }
 
 		print MYFH_NEW     "\t"  . 'read-only' . "\n";
 		if($opt_v) { print "\t"  . 'read-only' . "\n"; }