mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-20 16:39:31 +03:00
systemd-boot: sync efi filesystem after update
Since fat32 provides little recovery facilities after a crash, it can leave the system in an unbootable state, when a crash/outage happens shortly after an update. To decrease the likelihood of this event sync the efi filesystem after each update.
This commit is contained in:
parent
779ae06467
commit
e3beb07108
1 changed files with 7 additions and 0 deletions
|
@ -2,12 +2,15 @@
|
||||||
import argparse
|
import argparse
|
||||||
import shutil
|
import shutil
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import errno
|
import errno
|
||||||
import subprocess
|
import subprocess
|
||||||
import glob
|
import glob
|
||||||
import tempfile
|
import tempfile
|
||||||
import errno
|
import errno
|
||||||
import warnings
|
import warnings
|
||||||
|
import ctypes
|
||||||
|
libc = ctypes.CDLL("libc.so.6")
|
||||||
|
|
||||||
def copy_if_not_exists(source, dest):
|
def copy_if_not_exists(source, dest):
|
||||||
if not os.path.exists(dest):
|
if not os.path.exists(dest):
|
||||||
|
@ -145,5 +148,9 @@ def main():
|
||||||
if os.readlink(system_dir(gen)) == args.default_config:
|
if os.readlink(system_dir(gen)) == args.default_config:
|
||||||
write_loader_conf(gen)
|
write_loader_conf(gen)
|
||||||
|
|
||||||
|
rc = libc.syncfs(os.open("@efiSysMountPoint@", os.O_RDONLY))
|
||||||
|
if rc != 0:
|
||||||
|
print("could not sync @efiSysMountPoint@: {}".format(os.strerror(rc)), file=sys.stderr)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue