diff mbox

[2/5] UBUNTU: [Packaging] dtb: symlink from /boot/dtb-$(uname -r) to /boot/dtb

Message ID 1409153332-5001-3-git-send-email-paolo.pisati@canonical.com
State New
Headers show

Commit Message

Paolo Pisati Aug. 27, 2014, 3:28 p.m. UTC
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
---
 debian/control-scripts/postinst | 19 +++++++++++++++++++
 debian/control-scripts/postrm   |  2 ++
 2 files changed, 21 insertions(+)
diff mbox

Patch

diff --git a/debian/control-scripts/postinst b/debian/control-scripts/postinst
index c4fc23f..a388cef 100644
--- a/debian/control-scripts/postinst
+++ b/debian/control-scripts/postinst
@@ -37,6 +37,7 @@  my $ramdisk           = "/usr/sbin/update-initramfs";  # List of tools to create
 my $notifier          = "/usr/share/update-notifier/notify-reboot-required";
 my $package_name      = "linux-image-$version";
 my $explicit_do_loader = 'Yes';
+my $dtb               = 'dtb';
 
 my $Loader          = "NoLOADER"; #
 $Loader             = "LILO"     if $loader =~ /^lilo/io;
@@ -926,6 +927,24 @@  else {
   }
 }
 
+if (-e "$dtb-$version") {
+  if (! defined $ARGV[1] || ! $ARGV[1] || $ARGV[1] =~ m/<unknown>/og) {
+	image_magic($dtb, $image_dest);
+  }
+  else {
+	if (! -e "$dtb") {
+	  handle_missing_link($dtb, $image_dest, "$dtb-$version", 
+						  $realimageloc);
+	}
+	else {
+	  print STDERR
+		"Not updating dtb symbolic links since we are being updated/reinstalled \n";
+	  print STDERR
+		"($ARGV[1] was configured last, according to dpkg)\n";
+	}
+  }
+}
+
 # We used to have System.* files in /
 if (-e "/System.map" || -e "/System.old") {
   unlink '/System.map' if -e '/System.map';
diff --git a/debian/control-scripts/postrm b/debian/control-scripts/postrm
index 227e351..56f4182 100644
--- a/debian/control-scripts/postrm
+++ b/debian/control-scripts/postrm
@@ -348,6 +348,8 @@  if ($ARGV[0] !~ /upgrade/) {
   image_magic($kimage . ".old", $image_dest);
   image_magic("initrd.img",     $image_dest) if $initrd;
   image_magic("initrd.img.old", $image_dest) if $initrd;
+  image_magic("dtb",     $image_dest);
+  image_magic("dtb.old", $image_dest);
 }
 
 exit 0;