Do not overwrite the contents of mkinitcpio.conf (#2532)
This commit is contained in:
parent
9abd3a82cc
commit
3fa70722a9
|
|
@ -707,10 +707,11 @@ class Installer:
|
||||||
if plugin.on_mkinitcpio(self):
|
if plugin.on_mkinitcpio(self):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
with open(f'{self.target}/etc/mkinitcpio.conf', 'w') as mkinit:
|
with open(f'{self.target}/etc/mkinitcpio.conf', 'r+') as mkinit:
|
||||||
mkinit.write(f"MODULES=({' '.join(self._modules)})\n")
|
content = mkinit.read()
|
||||||
mkinit.write(f"BINARIES=({' '.join(self._binaries)})\n")
|
content = re.sub("\nMODULES=(.*)", f"\nMODULES=({' '.join(self._modules)})", content)
|
||||||
mkinit.write(f"FILES=({' '.join(self._files)})\n")
|
content = re.sub("\nBINARIES=(.*)", f"\nBINARIES=({' '.join(self._binaries)})", content)
|
||||||
|
content = re.sub("\nFILES=(.*)", f"\nFILES=({' '.join(self._files)})", content)
|
||||||
|
|
||||||
if not self._disk_encryption.hsm_device:
|
if not self._disk_encryption.hsm_device:
|
||||||
# For now, if we don't use HSM we revert to the old
|
# For now, if we don't use HSM we revert to the old
|
||||||
|
|
@ -720,7 +721,9 @@ class Installer:
|
||||||
# * sd-vconsole -> keymap
|
# * sd-vconsole -> keymap
|
||||||
self._hooks = [hook.replace('systemd', 'udev').replace('sd-vconsole', 'keymap consolefont') for hook in self._hooks]
|
self._hooks = [hook.replace('systemd', 'udev').replace('sd-vconsole', 'keymap consolefont') for hook in self._hooks]
|
||||||
|
|
||||||
mkinit.write(f"HOOKS=({' '.join(self._hooks)})\n")
|
content = re.sub("\nHOOKS=(.*)", f"\nHOOKS=({' '.join(self._hooks)})", content)
|
||||||
|
mkinit.seek(0)
|
||||||
|
mkinit.write(content)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
SysCommand(f'/usr/bin/arch-chroot {self.target} mkinitcpio {" ".join(flags)}', peek_output=True)
|
SysCommand(f'/usr/bin/arch-chroot {self.target} mkinitcpio {" ".join(flags)}', peek_output=True)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue