Skip to content

Commit

Permalink
[BGBUILD-359] Correct hacks to ensure they work with unlimited number…
Browse files Browse the repository at this point in the history
…s of partitions
  • Loading branch information
msavy committed Jul 18, 2012
1 parent b7a7703 commit 374d1ff
Showing 1 changed file with 2 additions and 2 deletions.
Expand Up @@ -205,13 +205,13 @@ def use_labels_for_partitions(guestfs)
device = guestfs.list_devices.first

# /etc/fstab
if fstab = guestfs.read_file('/etc/fstab').gsub!(/^(\/dev\/sda.)/) { |path| "LABEL=#{guestfs.vfs_label(path.gsub('/dev/sda', device))}" }
if fstab = guestfs.read_file('/etc/fstab').gsub!(%r(^(/dev/\w+da\d*))) { |path| "LABEL=#{guestfs.vfs_label(path.gsub('/dev/sda', device))}" }
guestfs.write_file('/etc/fstab', fstab, 0)
end

# /boot/grub/grub.conf
if guestfs.exists('/boot/grub/grub.conf') != 0
if grub = guestfs.read_file('/boot/grub/grub.conf').gsub!(/(\/dev\/sda.)/) { |path| "LABEL=#{guestfs.vfs_label(path.gsub('/dev/sda', device))}" }
if grub = guestfs.read_file('/boot/grub/grub.conf').gsub!(%r((/dev/\w+da\d*))) { |path| "LABEL=#{guestfs.vfs_label(path.gsub('/dev/sda', device))}" }
guestfs.write_file('/boot/grub/grub.conf', grub, 0)
end
end
Expand Down

0 comments on commit 374d1ff

Please sign in to comment.