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

Commit

Permalink
Browse files Browse the repository at this point in the history
Add mdadm.conf to initrd if needed (#895805)
Check to see if the system needs mdadm.conf to boot, and if so, add it
to the initramfs.
  • Loading branch information
wgwoods committed Feb 26, 2013
1 parent d1beabf commit f937c4a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fedup/boot.py
Expand Up @@ -55,3 +55,17 @@ def initramfs_append(initramfs, files):
(out, err) = cpio.communicate(input=filelist)
if cpio.returncode:
raise CalledProcessError(cpio.returncode, cmd, err)

def need_mdadmconf():
'''Does this system need /etc/mdadm.conf to boot?'''
# NOTE: there are probably systems that have mdadm.conf but don't require
# it to boot, but I don't know how you tell the difference, so...
try:
for line in open("/etc/mdadm.conf"):
line = line.strip()
if line and not line.startswith("#"):
# Hey there's actual *data* in here! WE MIGHT NEED THIS!!
return True
except IOError:
pass
return False
4 changes: 4 additions & 0 deletions fedup/sysprep.py
Expand Up @@ -141,6 +141,10 @@ def modify_bootloader(kernel, initrd):
boot.add_entry(kernel, initrd, banner=_("System Upgrade"), kargs=args)

def prep_boot(kernel, initrd):
# check for systems that need mdadm.conf
if boot.need_mdadmconf():
log.info("appending /etc/mdadm.conf to initrd")
boot.initramfs_append(initrd, "/etc/mdadm.conf")
# set up the boot args
modify_bootloader(kernel, initrd)

Expand Down

0 comments on commit f937c4a

Please sign in to comment.