[arch-commits] Commit in fwupdate/trunk (PKGBUILD create-fw-directory.patch)
Bruno Pagani
archange at archlinux.org
Mon Sep 4 00:02:37 UTC 2017
Date: Monday, September 4, 2017 @ 00:02:35
Author: archange
Revision: 255624
Add a fix for creating a missing dir at runtime
Added:
fwupdate/trunk/create-fw-directory.patch
Modified:
fwupdate/trunk/PKGBUILD
---------------------------+
PKGBUILD | 9 ++++--
create-fw-directory.patch | 62 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 3 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2017-09-03 22:20:38 UTC (rev 255623)
+++ PKGBUILD 2017-09-04 00:02:35 UTC (rev 255624)
@@ -3,7 +3,7 @@
pkgname=fwupdate
pkgver=9
-pkgrel=1
+pkgrel=2
pkgdesc="Tools for using the ESRT and UpdateCapsule() to apply firmware updates"
arch=('i686' 'x86_64')
url="https://github.com/rhinstaller/fwupdate"
@@ -12,10 +12,12 @@
makedepends=('pesign' 'gnu-efi-libs')
source=("${url}/releases/download/${pkgver}/${pkgname}-${pkgver}.tar.bz2"
'fix-uninitialized-variable.patch'
- 'fix-sprintf-formatting.patch')
+ 'fix-sprintf-formatting.patch'
+ 'create-fw-directory.patch')
sha256sums=('e926a7b33a58f5dbf029a5a687375e88b18a41f0742ba871aff7d1d82d075c87'
'56d27c36b7f1178c818c37153e3dbdd0a26036366b3dc935cd169b0c716cb610'
- '639114a5d98c688f92c59d08aac1b182da705ad443c8b1367160c7a8c4fcd115')
+ '639114a5d98c688f92c59d08aac1b182da705ad443c8b1367160c7a8c4fcd115'
+ 'fabe3dd8755cd73955893a4dc22cc9ff8965b5a873e2af7f781421fced3dc0ec')
install=fwupdate.install
_efidir=arch
@@ -24,6 +26,7 @@
cd ${pkgname}-${pkgver}
patch -p1 -i ../fix-uninitialized-variable.patch
patch -p1 -i ../fix-sprintf-formatting.patch
+ patch -p1 -i ../create-fw-directory.patch
}
build() {
Added: create-fw-directory.patch
===================================================================
--- create-fw-directory.patch (rev 0)
+++ create-fw-directory.patch 2017-09-04 00:02:35 UTC (rev 255624)
@@ -0,0 +1,62 @@
+From f713884b1766396aab4f0fb75a7cc7b8cb8319bb Mon Sep 17 00:00:00 2001
+From: Mario Limonciello <mario.limonciello at dell.com>
+Date: Tue, 11 Jul 2017 10:35:37 -0500
+Subject: [PATCH] create the 'fw' directory on the ESP if it doesn't exist
+
+---
+ linux/libfwup.c | 24 +++++++++++++++++++++---
+ 1 file changed, 21 insertions(+), 3 deletions(-)
+
+diff --git a/linux/libfwup.c b/linux/libfwup.c
+index 4aa2bf3..d37f644 100644
+--- a/linux/libfwup.c
++++ b/linux/libfwup.c
+@@ -1177,6 +1177,8 @@ get_existing_media_path(update_info *info)
+ static int
+ get_fd_and_media_path(update_info *info, char **path)
+ {
++ struct stat st;
++ char *directory = NULL;
+ char *fullpath = NULL;
+ int fd = -1;
+ int rc;
+@@ -1193,13 +1195,28 @@ get_fd_and_media_path(update_info *info, char **path)
+ }
+ } else {
+ /* fall back to creating a new file from scratch */
+- rc = asprintf(&fullpath,
+- "/boot/efi/EFI/%s/fw/fwupdate-XXXXXX.cap",
++ rc = asprintf(&directory,
++ "/boot/efi/EFI/%s/fw",
+ FWUP_EFI_DIR_NAME);
+ if (rc < 0) {
+- efi_error("asprintf failed");
++ efi_error("asprintf directory failed");
+ return fd;
+ }
++ if (stat(directory, &st) != 0 ||
++ (st.st_mode & S_IFDIR) == 0) {
++ rc = mkdir(directory, 0775);
++ if (rc < 0) {
++ efi_error("failed to make %s", directory);
++ goto out;
++ }
++ }
++ rc = asprintf(&fullpath,
++ "/boot/efi/EFI/%s/fw/fwupdate-XXXXXX.cap",
++ directory);
++ if (rc < 0) {
++ efi_error("asprintf fullpath failed");
++ goto out;
++ }
+ fd = mkostemps(fullpath, 4, O_CREAT|O_TRUNC|O_CLOEXEC);
+ if (fd < 0) {
+ efi_error("mkostemps(%s) failed", fullpath);
+@@ -1213,6 +1230,7 @@ get_fd_and_media_path(update_info *info, char **path)
+ fullpath = NULL;
+ }
+ out:
++ free(directory);
+ free(fullpath);
+ return fd;
+ }
More information about the arch-commits
mailing list