efi-boot-generator.c revision 6d26dfe11c853d612b84abe858520bbcb62c2e96
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen This file is part of systemd.
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen Copyright 2013 Lennart Poettering
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen systemd is free software; you can redistribute it and/or modify it
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen under the terms of the GNU Lesser General Public License as published by
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen (at your option) any later version.
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen systemd is distributed in the hope that it will be useful, but
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen Lesser General Public License for more details.
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen You should have received a copy of the GNU Lesser General Public License
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen log_error("This program takes three or no arguments.");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen if (path_is_mount_point("/boot", true) <= 0 &&
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen log_debug("/boot already populated, exiting.");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen log_debug("EFI loader partition unknown exiting.");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen } else if (r < 0) {
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen log_error("Failed to read ESP partition UUID: %s", strerror(-r));
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen log_error("Failed to create mount unit file %s: %m", name);
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen "/dev/disk/by-partuuid/%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen "# Automatially generated by systemd-efi-boot-generator\n\n"
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen "Description=EFI System Partition\n"
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen "Documentation=man:systemd-efi-boot-generator(8)\n");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen r = generator_write_fsck_deps(f, arg_dest, what, "/boot", "vfat");
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen "Where=/boot\n"
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen "Type=vfat\n"
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen "Options=umask=0077,noauto\n",
57fa1d094cd2c5ac68970526ad0a0754c548e75dTom Gundersen log_error("Failed to write mount unit file: %m");
fclose(f);
return EXIT_FAILURE;
fflush(f);
if (ferror(f)) {
return EXIT_FAILURE;
return EXIT_FAILURE;
return EXIT_SUCCESS;