From e4169135e8fa6b9bce5dc25ab08c163588e32015 Mon Sep 17 00:00:00 2001 From: Scott Moser Date: Wed, 12 Apr 2017 11:15:03 -0400 Subject: update-grub-legacy-ec2: fix early exit failure no /etc/fstab file. If /etc/fstab did not exist, then update-grub-legacy-ec2 would fail. That can cause upgrade or install of any kernel package to fail. LP: #1682160 --- debian/update-grub-legacy-ec2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/debian/update-grub-legacy-ec2 b/debian/update-grub-legacy-ec2 index fc2e4e41..c1c9dc79 100755 --- a/debian/update-grub-legacy-ec2 +++ b/debian/update-grub-legacy-ec2 @@ -370,7 +370,10 @@ boot_device=$(find_device "/boot") device_map=$grub_dir/device.map # Default kernel options, overidden by the kopt statement in the menufile. -loop_file=$(awk '$2=="/" && $4~"loop" {print $1}' /etc/fstab) +loop_file="" +if [ -f /etc/fstab ]; then + loop_file=$(awk '$2=="/" && $4~"loop" {print $1}' /etc/fstab) +fi if [ -n "$loop_file" ]; then dev_mountpoint=$(awk '"'${loop_file}'"~"^"$2 && $2!="/" {print $1";"$2}' /proc/mounts|tail -n 1) host_device="${dev_mountpoint%;*}" -- cgit v1.2.3