Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] mkinitcpio: sync hooks with upstream.
@ 2019-06-24  5:16 voidlinux-github
  2019-06-24  5:22 ` voidlinux-github
  2019-07-30 11:54 ` voidlinux-github
  0 siblings, 2 replies; 3+ messages in thread
From: voidlinux-github @ 2019-06-24  5:16 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 493 bytes --]

There is a new pull request by travankor against master on the void-packages repository

https://github.com/travankor/void-packages mkinitcpio
https://github.com/void-linux/void-packages/pull/12646

mkinitcpio: sync hooks with upstream.
Updates the lvm2 and encrypt hooks to fix bugs, notably:
https://bugs.archlinux.org/task/56771
Removes unused ucode hook, which mkinitcpio does not support anyways.

A patch file from https://github.com/void-linux/void-packages/pull/12646.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-mkinitcpio-12646.patch --]
[-- Type: application/text/x-diff, Size: 8026 bytes --]

From 81b9ce3c74bf7167a0cd82482562d920814d8ccf Mon Sep 17 00:00:00 2001
From: travankor <travankor@tuta.io>
Date: Sun, 23 Jun 2019 21:57:44 -0700
Subject: [PATCH] mkinitcpio: sync hooks with upstream.

Updates the lvm2 and encrypt hooks to fix bugs, notably:
https://bugs.archlinux.org/task/56771
Removes unused ucode hook, which mkinitcpio does not support anyways.
---
 srcpkgs/mkinitcpio/files/encrypt_hook    | 13 +++++++---
 srcpkgs/mkinitcpio/files/encrypt_install |  7 ++++--
 srcpkgs/mkinitcpio/files/lvm2_hook       | 13 ++++++++++
 srcpkgs/mkinitcpio/files/lvm2_install    | 32 +++++++++++++++---------
 srcpkgs/mkinitcpio/files/ucode_install   | 23 -----------------
 srcpkgs/mkinitcpio/template              |  6 ++---
 6 files changed, 50 insertions(+), 44 deletions(-)
 delete mode 100644 srcpkgs/mkinitcpio/files/ucode_install

diff --git a/srcpkgs/mkinitcpio/files/encrypt_hook b/srcpkgs/mkinitcpio/files/encrypt_hook
index 819c4cf60fe..882d5fb4423 100644
--- a/srcpkgs/mkinitcpio/files/encrypt_hook
+++ b/srcpkgs/mkinitcpio/files/encrypt_hook
@@ -44,6 +44,12 @@ EOF
         cryptname="root"
     fi
 
+    # This may happen if third party hooks do the crypt setup
+    if [ -b "/dev/mapper/${cryptname}" ]; then
+        echo "Device ${cryptname} already exists, not doing any crypt setup."
+        return 0
+    fi
+
     warn_deprecated() {
         echo "The syntax 'root=${root}' where '${root}' is an encrypted volume is deprecated"
         echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
@@ -88,7 +94,7 @@ EOF
                 fi
             else
                 err "Password succeeded, but ${cryptname} creation failed, aborting..."
-                exit 1
+                return 1
             fi
         elif [ -n "${crypto}" ]; then
             [ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
@@ -110,7 +116,6 @@ EOF
             if [ -f "$ckeyfile" ]; then
                 exe="$exe --key-file $ckeyfile"
             else
-                exe="$exe --verify-passphrase"
                 echo ""
                 echo "A password is required to access the ${cryptname} volume:"
             fi
@@ -119,7 +124,7 @@ EOF
             if [ $? -ne 0 ]; then
                 err "Non-LUKS device decryption failed. verify format: "
                 err "      crypto=hash:cipher:keysize:offset:skip"
-                exit 1
+                return 1
             fi
             if [ -e "/dev/mapper/${cryptname}" ]; then
                 if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
@@ -127,7 +132,7 @@ EOF
                 fi
             else
                 err "Password succeeded, but ${cryptname} creation failed, aborting..."
-                exit 1
+                return 1
             fi
         else
             err "Failed to open encryption mapping: The device ${cryptdev} is not a LUKS volume and the crypto= paramater was not specified."
diff --git a/srcpkgs/mkinitcpio/files/encrypt_install b/srcpkgs/mkinitcpio/files/encrypt_install
index 38e5ddc57b1..017ba0030ab 100644
--- a/srcpkgs/mkinitcpio/files/encrypt_install
+++ b/srcpkgs/mkinitcpio/files/encrypt_install
@@ -3,13 +3,13 @@
 build() {
     local mod
 
-    add_module dm-crypt
+    add_module "dm-crypt"
     if [[ $CRYPTO_MODULES ]]; then
         for mod in $CRYPTO_MODULES; do
             add_module "$mod"
         done
     else
-        add_all_modules '/crypto/'
+        add_all_modules "/crypto/"
     fi
 
     add_binary "cryptsetup"
@@ -19,6 +19,9 @@ build() {
     add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
     add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
 
+    # cryptsetup calls pthread_create(), which dlopen()s libgcc_s.so.1
+    add_binary "/usr/lib/libgcc_s.so.1"
+
     add_runscript
 }
 
diff --git a/srcpkgs/mkinitcpio/files/lvm2_hook b/srcpkgs/mkinitcpio/files/lvm2_hook
index 65de7bd2fdd..3c28d67ffb9 100644
--- a/srcpkgs/mkinitcpio/files/lvm2_hook
+++ b/srcpkgs/mkinitcpio/files/lvm2_hook
@@ -5,6 +5,19 @@ run_earlyhook() {
     lvmetad
 }
 
+# We are suffering a race condition in non-systemd initramfs: If lvmetad is
+# killed before pvscan processes finish we have stale processes and
+# uninitialized physical volumes. So wait for pvscan processes to finish.
+# Break after 10 seconds (50*0.2s) to avaid infinite loop.
+run_latehook() {
+    local i=50
+
+    while pgrep -f pvscan >/dev/null 2>/dev/null && [ $i -gt 0 ]; do
+        sleep 0.2
+        i=$((i - 1))
+    done
+}
+
 run_cleanuphook() {
     kill $(cat /run/lvmetad.pid)
 }
diff --git a/srcpkgs/mkinitcpio/files/lvm2_install b/srcpkgs/mkinitcpio/files/lvm2_install
index 7ae6daf3f26..d7a63332a40 100644
--- a/srcpkgs/mkinitcpio/files/lvm2_install
+++ b/srcpkgs/mkinitcpio/files/lvm2_install
@@ -2,26 +2,34 @@
 
 build() {
     local mod
-    for mod in dm-mod dm-snapshot dm-mirror dm-cache dm-cache-mq; do
+    local symlink
+
+    # device mapper modules
+    for mod in dm-mod dm-snapshot dm-mirror dm-cache dm-cache-smq dm-thin-pool; do
         add_module "$mod"
     done
 
-    add_binary "/usr/bin/lvm"
-    add_binary "/usr/bin/lvmetad"
-    add_binary "/usr/bin/dmsetup"
-    add_binary "/usr/bin/cache_check"
-    add_binary "/usr/bin/cache_dump"
-    add_binary "/usr/bin/cache_metadata_size"
-    add_binary "/usr/bin/cache_repair"
-    add_binary "/usr/bin/cache_restore"
+    # binaries from lvm2
+    add_binary "lvm"
+    add_binary "lvmetad"
+
+    # beinaries from device-mapper
+    add_binary "dmsetup"
+
+    # from thin-provisioning-tools
+    add_binary "pdata_tools"
+    for symlink in cache_{check,dump,metadata_size,repair,restore} thin_{check,delta,dump,ls,metadata_size,repair,restore,rmap,trim}; do
+        add_symlink "/usr/bin/${symlink}" "pdata_tools"
+    done
+
+    # udev rules and lvm configuration
     add_file "/usr/lib/udev/rules.d/10-dm.rules"
+    add_file "/usr/lib/udev/rules.d/11-dm-lvm.rules"
     add_file "/usr/lib/udev/rules.d/13-dm-disk.rules"
     add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
-    add_file "/usr/lib/udev/rules.d/11-dm-lvm.rules"
-    add_file "/usr/lib/initcpio/udev/69-dm-lvm-metad.rules" "/usr/lib/udev/rules.d/69-dm-lvm-metad.rules"
     add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
+    add_file "/usr/lib/initcpio/udev/69-dm-lvm-metad.rules" "/usr/lib/udev/rules.d/69-dm-lvm-metad.rules"
     add_file "/etc/lvm/lvm.conf"
-    sed -i "/^\s\s*use_lvmetad/c use_lvmetad = 1" "$BUILDROOT/etc/lvm/lvm.conf"
 
     add_runscript
 }
diff --git a/srcpkgs/mkinitcpio/files/ucode_install b/srcpkgs/mkinitcpio/files/ucode_install
deleted file mode 100644
index 718d0d0e1ee..00000000000
--- a/srcpkgs/mkinitcpio/files/ucode_install
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/bash
-
-build() {
-    for bin in /usr/bin/xbps-*; do
-        add_binary "$bin"
-    done
-
-    for key in /var/db/xbps/keys/*; do
-        add_file "$key"
-    done
-
-    for conf in /usr/share/xbps.d/*; do
-        add_file "$conf"
-    done
-}
-
-help() {
-    cat <<HELPEOF
-This hook will add intel-ucode files to the initcpio.
-HELPEOF
-}
-
-# vim: set ft=sh ts=4 sw=4 et:
diff --git a/srcpkgs/mkinitcpio/template b/srcpkgs/mkinitcpio/template
index 1b84ded03ae..ee0e621baf7 100644
--- a/srcpkgs/mkinitcpio/template
+++ b/srcpkgs/mkinitcpio/template
@@ -1,15 +1,15 @@
 # Template file for 'mkinitcpio'
 pkgname=mkinitcpio
 version=25
-revision=1
+revision=2
 archs=noarch
 build_style=gnu-makefile
 depends="busybox-static bsdtar bash"
 short_desc="Next generation of initramfs creation"
 maintainer="Andrea Brancaleoni <abc@pompel.me>"
-license="GPL-2"
+license="GPL-2.0-only"
 homepage="https://wiki.archlinux.org/index.php/Mkinitcpio"
-distfiles="https://sources.archlinux.org/other/$pkgname/$pkgname-$version.tar.gz"
+distfiles="https://sources.archlinux.org/other/${pkgname}/${pkgname}-${version}.tar.gz"
 checksum=e14056a9c460d15652e99620bce4308d4dd9309f82c152c4b52287e697fab599
 
 conf_files="/etc/mkinitcpio.conf"

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-30 11:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-24  5:16 [PR PATCH] mkinitcpio: sync hooks with upstream voidlinux-github
2019-06-24  5:22 ` voidlinux-github
2019-07-30 11:54 ` voidlinux-github

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).