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.
This commit is contained in:
parent
4f8c8052bb
commit
582c992be1
6 changed files with 50 additions and 44 deletions
|
@ -44,6 +44,12 @@ EOF
|
||||||
cryptname="root"
|
cryptname="root"
|
||||||
fi
|
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() {
|
warn_deprecated() {
|
||||||
echo "The syntax 'root=${root}' where '${root}' is an encrypted volume is deprecated"
|
echo "The syntax 'root=${root}' where '${root}' is an encrypted volume is deprecated"
|
||||||
echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
|
echo "Use 'cryptdevice=${root}:root root=/dev/mapper/root' instead."
|
||||||
|
@ -88,7 +94,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
err "Password succeeded, but ${cryptname} creation failed, aborting..."
|
err "Password succeeded, but ${cryptname} creation failed, aborting..."
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
elif [ -n "${crypto}" ]; then
|
elif [ -n "${crypto}" ]; then
|
||||||
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
|
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
|
||||||
|
@ -110,7 +116,6 @@ EOF
|
||||||
if [ -f "$ckeyfile" ]; then
|
if [ -f "$ckeyfile" ]; then
|
||||||
exe="$exe --key-file $ckeyfile"
|
exe="$exe --key-file $ckeyfile"
|
||||||
else
|
else
|
||||||
exe="$exe --verify-passphrase"
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "A password is required to access the ${cryptname} volume:"
|
echo "A password is required to access the ${cryptname} volume:"
|
||||||
fi
|
fi
|
||||||
|
@ -119,7 +124,7 @@ EOF
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
err "Non-LUKS device decryption failed. verify format: "
|
err "Non-LUKS device decryption failed. verify format: "
|
||||||
err " crypto=hash:cipher:keysize:offset:skip"
|
err " crypto=hash:cipher:keysize:offset:skip"
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if [ -e "/dev/mapper/${cryptname}" ]; then
|
if [ -e "/dev/mapper/${cryptname}" ]; then
|
||||||
if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
|
if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
|
||||||
|
@ -127,7 +132,7 @@ EOF
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
err "Password succeeded, but ${cryptname} creation failed, aborting..."
|
err "Password succeeded, but ${cryptname} creation failed, aborting..."
|
||||||
exit 1
|
return 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
err "Failed to open encryption mapping: The device ${cryptdev} is not a LUKS volume and the crypto= paramater was not specified."
|
err "Failed to open encryption mapping: The device ${cryptdev} is not a LUKS volume and the crypto= paramater was not specified."
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
build() {
|
build() {
|
||||||
local mod
|
local mod
|
||||||
|
|
||||||
add_module dm-crypt
|
add_module "dm-crypt"
|
||||||
if [[ $CRYPTO_MODULES ]]; then
|
if [[ $CRYPTO_MODULES ]]; then
|
||||||
for mod in $CRYPTO_MODULES; do
|
for mod in $CRYPTO_MODULES; do
|
||||||
add_module "$mod"
|
add_module "$mod"
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
add_all_modules '/crypto/'
|
add_all_modules "/crypto/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
add_binary "cryptsetup"
|
add_binary "cryptsetup"
|
||||||
|
@ -19,6 +19,9 @@ build() {
|
||||||
add_file "/usr/lib/udev/rules.d/95-dm-notify.rules"
|
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"
|
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
|
add_runscript
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,19 @@ run_earlyhook() {
|
||||||
lvmetad
|
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() {
|
run_cleanuphook() {
|
||||||
kill $(cat /run/lvmetad.pid)
|
kill $(cat /run/lvmetad.pid)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,26 +2,34 @@
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
local mod
|
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"
|
add_module "$mod"
|
||||||
done
|
done
|
||||||
|
|
||||||
add_binary "/usr/bin/lvm"
|
# binaries from lvm2
|
||||||
add_binary "/usr/bin/lvmetad"
|
add_binary "lvm"
|
||||||
add_binary "/usr/bin/dmsetup"
|
add_binary "lvmetad"
|
||||||
add_binary "/usr/bin/cache_check"
|
|
||||||
add_binary "/usr/bin/cache_dump"
|
# beinaries from device-mapper
|
||||||
add_binary "/usr/bin/cache_metadata_size"
|
add_binary "dmsetup"
|
||||||
add_binary "/usr/bin/cache_repair"
|
|
||||||
add_binary "/usr/bin/cache_restore"
|
# 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/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/13-dm-disk.rules"
|
||||||
add_file "/usr/lib/udev/rules.d/95-dm-notify.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/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"
|
add_file "/etc/lvm/lvm.conf"
|
||||||
sed -i "/^\s\s*use_lvmetad/c use_lvmetad = 1" "$BUILDROOT/etc/lvm/lvm.conf"
|
|
||||||
|
|
||||||
add_runscript
|
add_runscript
|
||||||
}
|
}
|
||||||
|
|
|
@ -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:
|
|
|
@ -1,15 +1,15 @@
|
||||||
# Template file for 'mkinitcpio'
|
# Template file for 'mkinitcpio'
|
||||||
pkgname=mkinitcpio
|
pkgname=mkinitcpio
|
||||||
version=25
|
version=25
|
||||||
revision=1
|
revision=2
|
||||||
archs=noarch
|
archs=noarch
|
||||||
build_style=gnu-makefile
|
build_style=gnu-makefile
|
||||||
depends="busybox-static bsdtar bash"
|
depends="busybox-static bsdtar bash"
|
||||||
short_desc="Next generation of initramfs creation"
|
short_desc="Next generation of initramfs creation"
|
||||||
maintainer="Andrea Brancaleoni <abc@pompel.me>"
|
maintainer="Andrea Brancaleoni <abc@pompel.me>"
|
||||||
license="GPL-2"
|
license="GPL-2.0-only"
|
||||||
homepage="https://wiki.archlinux.org/index.php/Mkinitcpio"
|
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
|
checksum=e14056a9c460d15652e99620bce4308d4dd9309f82c152c4b52287e697fab599
|
||||||
|
|
||||||
conf_files="/etc/mkinitcpio.conf"
|
conf_files="/etc/mkinitcpio.conf"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue