Skip to content
This repository has been archived by the owner on May 22, 2019. It is now read-only.

Commit

Permalink
Merge pull request #192 from lots0logs/master
Browse files Browse the repository at this point in the history
verify root uuid in grub.cfg and fix if necessary
  • Loading branch information
karasu committed May 13, 2014
2 parents 9b0bd87 + b3c7c1f commit 8c4c390
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion data/packages.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<pkgname>gnome-screenshot</pkgname>
<pkgname>gnome-shell</pkgname>
<pkgname>gnome-shell-extensions</pkgname>
<!-- <pkgname>gnome-shell-extension-dash-to-dock</pkgname> -->
<pkgname>gnome-shell-extension-dash-to-dock</pkgname>
<pkgname>gnome-shell-extension-lockscreen-lightdm</pkgname>
<pkgname>gnome-system-monitor</pkgname>
<pkgname>gnome-terminal</pkgname>
Expand All @@ -123,6 +123,7 @@
<pkgname>xdg-user-dirs-gtk</pkgname>
<pkgname>xfburn</pkgname>
<pkgname>xnoise</pkgname>
<pkgname>xscreensaver</pkgname>
<pkgname>zukitwo-themes</pkgname>
</gnome_desktop>

Expand Down
23 changes: 20 additions & 3 deletions src/installation/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,19 +940,20 @@ def auto_fstab(self):
else:
for i in self.ssd:
if i in self.mount_devices[path]:
opts = 'defaults,relatime'
opts = 'rw,defaults,noatime'
# As of linux kernel version 3.7, the following
# filesystems support TRIM: ext4, btrfs, JFS, and XFS.
# If using a TRIM supported SSD, discard is a valid mount option for swap
if myfmt == 'ext4' or myfmt == 'jfs' or myfmt == 'xfs' or myfmt == 'swap':
opts += ',discard'
elif myfmt == 'btrfs':
opts += ',rw,compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache'
opts += ',compress=lzo,ssd,discard,space_cache,autodefrag,inode_cache'

no_check = ["btrfs", "f2fs"]
if path == "/" and myfmt not in no_check:
chk = '1'

if path == "/":
self.settings.set('ruuid', uuid)
all_lines.append("UUID=%s %s %s %s 0 %s" % (uuid, path, myfmt, opts, chk))
logging.debug(_("Added to fstab : UUID=%s %s %s %s 0 %s"), uuid, path, myfmt, opts, chk)

Expand Down Expand Up @@ -985,6 +986,22 @@ def install_bootloader(self):
else:
self.install_bootloader_grub2_efi(bootloader)

# Check grub.cfg for correct root UUID
cfg = os.path.join(self.dest_dir, "boot/grub/grub.cfg")
ruuid = self.settings.get('ruuid')

if ruuid not in open(cfg).read():
with open(cfg) as grub_cfg:
lines = [x.strip() for x in grub_cfg.readlines()]
for i in range(len(lines)):
if lines[i].startswith("linux /vmlinuz-linux root="):
old_line = lines[i]
p1 = old_line[68:]
p2 = old_line[:26]
lines[i] = p1 + ruuid + p2
with open(cfg, 'w') as grub_file:
grub_file.write("\n".join(lines))

def modify_grub_default(self):
""" If using LUKS, we need to modify GRUB_CMDLINE_LINUX to load our root encrypted partition
This scheme can be used in the automatic installation option only (at this time) """
Expand Down

0 comments on commit 8c4c390

Please sign in to comment.