Merge pull request #1899 from thypon/mkinitcpio
New package: mkinitcpio-18
This commit is contained in:
commit
4279c09028
33 changed files with 2643 additions and 13 deletions
|
@ -1 +0,0 @@
|
|||
busybox
|
1
srcpkgs/busybox-ntpd/files
Symbolic link
1
srcpkgs/busybox-ntpd/files
Symbolic link
|
@ -0,0 +1 @@
|
|||
../busybox/files/
|
1
srcpkgs/busybox-ntpd/patches
Symbolic link
1
srcpkgs/busybox-ntpd/patches
Symbolic link
|
@ -0,0 +1 @@
|
|||
../busybox/patches/
|
43
srcpkgs/busybox-ntpd/template
Normal file
43
srcpkgs/busybox-ntpd/template
Normal file
|
@ -0,0 +1,43 @@
|
|||
# Build template for 'busybox-ntpd'.
|
||||
pkgname=busybox-ntpd
|
||||
version=1.23.2
|
||||
revision=1
|
||||
wrksrc="busybox-$version"
|
||||
hostmakedepends="perl"
|
||||
short_desc="The Swiss Army Knife of Embedded Linux (ntpd)"
|
||||
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
||||
license="GPL-2"
|
||||
homepage="http://www.busybox.net"
|
||||
distfiles="${homepage}/downloads/busybox-$version.tar.bz2"
|
||||
checksum=05a6f9e21aad8c098e388ae77de7b2361941afa7157ef74216703395b14e319a
|
||||
|
||||
pre_build() {
|
||||
mkdir -p src
|
||||
mv * src || true
|
||||
|
||||
local t="busybox-ntpd"
|
||||
mkdir -p $t
|
||||
make -C $t CFLAGS="$CFLAGS" KBUILD_SRC=${wrksrc}/src \
|
||||
-f ${wrksrc}/src/Makefile defconfig
|
||||
cp -f ${FILESDIR}/${t}.dotconfig ${t}/.config
|
||||
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
*-musl) sed -i -e /CONFIG_FEATURE_VI_REGEX_SEARCH/s/y/n/ \
|
||||
-e /CONFIG_FEATURE_MOUNT_NFS/s/y/n/ \
|
||||
${t}/.config;;
|
||||
esac
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
sed -e \
|
||||
"s,\(CONFIG_CROSS_COMPILER_PREFIX\).*,\1=\"${XBPS_CROSS_TRIPLET}-\",g" \
|
||||
-i ${t}/.config
|
||||
fi
|
||||
}
|
||||
do_build() {
|
||||
local t="busybox-ntpd"
|
||||
make -C $t SKIP_STRIP=y CFLAGS="$CFLAGS" ${makejobs}
|
||||
}
|
||||
do_install() {
|
||||
vbin busybox-ntpd/busybox_unstripped busybox-ntpd
|
||||
vsv busybox-ntpd
|
||||
}
|
1
srcpkgs/busybox-ntpd/update
Normal file
1
srcpkgs/busybox-ntpd/update
Normal file
|
@ -0,0 +1 @@
|
|||
ignore="*.0"
|
|
@ -1,7 +1,7 @@
|
|||
# Build template for 'busybox'.
|
||||
pkgname=busybox
|
||||
version=1.23.2
|
||||
revision=1
|
||||
revision=2
|
||||
hostmakedepends="perl"
|
||||
short_desc="The Swiss Army Knife of Embedded Linux"
|
||||
maintainer="Juan RP <xtraeme@voidlinux.eu>"
|
||||
|
@ -24,12 +24,12 @@ pre_build() {
|
|||
mv * src || true
|
||||
|
||||
local t
|
||||
for t in busybox busybox-static busybox-ntpd; do
|
||||
for t in busybox busybox-static; do
|
||||
mkdir -p $t
|
||||
make -C $t CFLAGS="$(_cflags $t)" KBUILD_SRC=${wrksrc}/src \
|
||||
-f ${wrksrc}/src/Makefile defconfig
|
||||
cp -f ${FILESDIR}/${t}.dotconfig ${t}/.config
|
||||
|
||||
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
*-musl) sed -i -e /CONFIG_FEATURE_VI_REGEX_SEARCH/s/y/n/ \
|
||||
-e /CONFIG_FEATURE_MOUNT_NFS/s/y/n/ \
|
||||
|
@ -45,7 +45,7 @@ pre_build() {
|
|||
}
|
||||
do_build() {
|
||||
local t
|
||||
for t in busybox busybox-static busybox-ntpd; do
|
||||
for t in busybox busybox-static; do
|
||||
make -C $t SKIP_STRIP=y CFLAGS="$(_cflags $t)" ${makejobs}
|
||||
done
|
||||
}
|
||||
|
@ -60,11 +60,3 @@ busybox-static_package() {
|
|||
vbin busybox-static/busybox busybox.static
|
||||
}
|
||||
}
|
||||
|
||||
busybox-ntpd_package() {
|
||||
short_desc+=" (ntpd)"
|
||||
pkg_install() {
|
||||
vbin busybox-ntpd/busybox_unstripped busybox-ntpd
|
||||
vsv busybox-ntpd
|
||||
}
|
||||
}
|
||||
|
|
1
srcpkgs/mkinitcpio-encrypt
Symbolic link
1
srcpkgs/mkinitcpio-encrypt
Symbolic link
|
@ -0,0 +1 @@
|
|||
mkinitcpio
|
21
srcpkgs/mkinitcpio-encryptssh/template
Normal file
21
srcpkgs/mkinitcpio-encryptssh/template
Normal file
|
@ -0,0 +1,21 @@
|
|||
# Template file for 'mkinitcpio-encryptssh'
|
||||
pkgname=mkinitcpio-encryptssh
|
||||
version=0.16
|
||||
revision=1
|
||||
_realname=dropbear_initrd_encrypt
|
||||
wrksrc="$_realname-$version-$revision"
|
||||
noarch=yes
|
||||
depends="mkinitcpio cryptsetup dropbear mkinitcpio-nfs-utils psmisc iproute2"
|
||||
short_desc="Allows for an encrypted root device to be unlocked remotely over SSH"
|
||||
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
|
||||
license="GPL-3"
|
||||
homepage="https://github.com/grazzolini/dropbear_initrd_encrypt"
|
||||
distfiles="$homepage/archive/v$version-$revision.tar.gz"
|
||||
checksum=6b24ea3d6e1ee55d304ca31707fe17c545f7ea843a13b764e22475f838c41eae
|
||||
|
||||
do_install() {
|
||||
vinstall dropbear_hook 644 usr/lib/initcpio/hooks dropbear
|
||||
vinstall dropbear_install 644 usr/lib/initcpio/install dropbear
|
||||
vinstall encryptssh_hook 644 usr/lib/initcpio/hooks encryptssh
|
||||
vinstall encryptssh_install 644 usr/lib/initcpio/install encryptssh
|
||||
}
|
1
srcpkgs/mkinitcpio-lvm2
Symbolic link
1
srcpkgs/mkinitcpio-lvm2
Symbolic link
|
@ -0,0 +1 @@
|
|||
mkinitcpio
|
1
srcpkgs/mkinitcpio-mdadm
Symbolic link
1
srcpkgs/mkinitcpio-mdadm
Symbolic link
|
@ -0,0 +1 @@
|
|||
mkinitcpio
|
90
srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net
Normal file
90
srcpkgs/mkinitcpio-nfs-utils/files/initcpio-hook-net
Normal file
|
@ -0,0 +1,90 @@
|
|||
# vim: set ft=sh:
|
||||
run_hook() {
|
||||
local line i net_mac bootif_mac bootif_dev defaultrootpath defaultserver
|
||||
# These variables will be parsed from /tmp/net-*.conf generated by ipconfig
|
||||
local DEVICE
|
||||
local IPV4ADDR IPV4BROADCAST IPV4NETMASK IPV4GATEWAY IPV4DNS0 IPV4DNS1
|
||||
local HOSTNAME DNSDOMAIN NISDOMAIN ROOTSERVER ROOTPATH
|
||||
local filename
|
||||
# /tmp/net-*.conf
|
||||
|
||||
if [ -z "${ip}" -a -n "${nfsaddrs}" ]; then
|
||||
ip="${nfsaddrs}"
|
||||
fi
|
||||
|
||||
if [ -n "${ip}" ]; then
|
||||
if [ -n "${BOOTIF}" ]; then
|
||||
bootif_mac=${BOOTIF#01-}
|
||||
bootif_mac=${bootif_mac//-/:}
|
||||
for i in /sys/class/net/*/address; do
|
||||
read net_mac < ${i}
|
||||
if [ "${bootif_mac}" == "${net_mac}" ]; then
|
||||
bootif_dev=${i#/sys/class/net/}
|
||||
bootif_dev=${bootif_dev%/address}
|
||||
break
|
||||
fi
|
||||
done
|
||||
ip="${ip}::${bootif_dev}"
|
||||
fi
|
||||
|
||||
# setup network and save some values
|
||||
ipconfig "ip=${ip}"
|
||||
|
||||
for conf in /tmp/net-*.conf; do
|
||||
[ -f "$conf" ] && . "$conf"
|
||||
done
|
||||
|
||||
# calculate nfs_server, nfs_path and nfs_option for later nfs mount
|
||||
if [ "${root}" = "/dev/nfs" -o "${nfsroot}" != "" ]; then
|
||||
# parse ROOTPATH if defined by dhcp server
|
||||
if [ -n "${ROOTPATH}" ]; then
|
||||
line="${ROOTPATH}"
|
||||
nfs_server="${line%%:*}"
|
||||
[ "${nfs_server}" = "${line}" ] && nfs_server="${ROOTSERVER}"
|
||||
defaultserver="${nfs_server}"
|
||||
line="${line#*:}"
|
||||
nfs_path="${line}"
|
||||
defaultrootpath="${nfs_path}"
|
||||
else
|
||||
# define a default ROOTPATH
|
||||
if [ "${ROOTPATH}" = "" ]; then
|
||||
defaultrootpath="/tftpboot/${IPV4ADDR}"
|
||||
fi
|
||||
fi
|
||||
|
||||
# parse nfsroot if present (overrides ROOTPATH)
|
||||
if [ -n "${nfsroot}" ]; then
|
||||
line="${nfsroot}"
|
||||
nfs_server="${line%%:*}"
|
||||
[ -z "${nfs_server}" ] && nfs_server="${defaultserver}"
|
||||
line="${line#*:}"
|
||||
nfs_path="${line%%,*}"
|
||||
line="${line#"${nfs_path}"}"
|
||||
[ -z "${nfs_path}" ] && nfs_path="${defaultrootpath}"
|
||||
nfs_option="${line#","}"
|
||||
fi
|
||||
|
||||
# ensure root and filesystem type are set proper for nfs boot
|
||||
root="/dev/nfs"
|
||||
rootfstype="nfs"
|
||||
|
||||
echo "NFS-Mount: ${nfs_server}:${nfs_path}"
|
||||
|
||||
# set mount handler for NFS
|
||||
mount_handler="nfs_mount_handler"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
nfs_mount_handler() {
|
||||
if [ -z "$nfs_server" -o -z "$nfs_path" ]; then
|
||||
err "Unable to mount root filesystem over NFS: wrong parameters."
|
||||
echo "You are being dropped to a recovery shell"
|
||||
echo " Type 'exit' to try and continue booting"
|
||||
launch_interactive_shell
|
||||
msg "Trying to continue (this will most likely fail) ..."
|
||||
fi
|
||||
nfsmount ${nfs_option:+-o ${nfs_option}} "${nfs_server}:${nfs_path}" "$1"
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
108
srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net
Normal file
108
srcpkgs/mkinitcpio-nfs-utils/files/initcpio-install-net
Normal file
|
@ -0,0 +1,108 @@
|
|||
#!/bin/bash
|
||||
|
||||
build() {
|
||||
add_checked_modules '/drivers/net/'
|
||||
add_module nfsv3?
|
||||
|
||||
add_binary "/usr/lib/initcpio/ipconfig" "/bin/ipconfig"
|
||||
add_binary "/usr/lib/initcpio/nfsmount" "/bin/nfsmount"
|
||||
|
||||
add_runscript
|
||||
}
|
||||
|
||||
help() {
|
||||
cat <<HELPEOF
|
||||
This hook loads the necessary modules for a network device.
|
||||
Detection will take place at runtime. To minimize the modules
|
||||
in the image, add the autodetect hook too.
|
||||
For pcmcia net devices please use pcmcia hook too.
|
||||
|
||||
Kernel Parameters:
|
||||
An interface spec can be either short form, which is just the name of
|
||||
an interface (eth0 or whatever), or long form. The long form consists
|
||||
of up to seven elements, separated by colons:
|
||||
|
||||
ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf>
|
||||
nfsaddrs= is an alias to ip= and can be used too.
|
||||
|
||||
<client-ip> IP address of the client. If empty, the address will
|
||||
either be determined by RARP/BOOTP/DHCP. What protocol
|
||||
is used de- pends on the <autoconf> parameter. If this
|
||||
parameter is not empty, autoconf will be used.
|
||||
|
||||
<server-ip> IP address of the NFS server. If RARP is used to
|
||||
determine the client address and this parameter is NOT
|
||||
empty only replies from the specified server are
|
||||
accepted. To use different RARP and NFS server,
|
||||
specify your RARP server here (or leave it blank), and
|
||||
specify your NFS server in the 'nfsroot' parameter
|
||||
(see above). If this entry is blank the address of the
|
||||
server is used which answered the RARP/BOOTP/DHCP
|
||||
request.
|
||||
|
||||
<gw-ip> IP address of a gateway if the server is on a different
|
||||
subnet. If this entry is empty no gateway is used and the
|
||||
server is assumed to be on the local network, unless a
|
||||
value has been received by BOOTP/DHCP.
|
||||
|
||||
<netmask> Netmask for local network interface. If this is empty,
|
||||
the netmask is derived from the client IP address assuming
|
||||
classful addressing, unless overridden in BOOTP/DHCP reply.
|
||||
|
||||
<hostname> Name of the client. If empty, the client IP address is
|
||||
used in ASCII notation, or the value received by
|
||||
BOOTP/DHCP.
|
||||
|
||||
<device> Name of network device to use. If this is empty, all
|
||||
devices are used for RARP/BOOTP/DHCP requests, and the
|
||||
first one we receive a reply on is configured. If you
|
||||
have only one device, you can safely leave this blank.
|
||||
|
||||
<autoconf> Method to use for autoconfiguration. If this is either
|
||||
'rarp', 'bootp', or 'dhcp' the specified protocol is
|
||||
used. If the value is 'both', 'all' or empty, all
|
||||
protocols are used. 'off', 'static' or 'none' means
|
||||
no autoconfiguration.
|
||||
Examples:
|
||||
ip=127.0.0.1:::::lo:none --> Enable the loopback interface.
|
||||
ip=192.168.1.1:::::eth2:none --> Enable static eth2 interface.
|
||||
ip=:::::eth0:dhcp --> Enable dhcp protcol for eth0 configuration.
|
||||
|
||||
nfsroot=[<server-ip>:]<root-dir>[,<nfs-options>]
|
||||
|
||||
If the 'nfsroot' parameter is NOT given on the command line, the default
|
||||
"/tftpboot/%s" will be used.
|
||||
|
||||
<server-ip> Specifies the IP address of the NFS server. If this field
|
||||
is not given, the default address as determined by the
|
||||
'ip' variable (see below) is used. One use of this
|
||||
parameter is for example to allow using different servers
|
||||
for RARP and NFS. Usually you can leave this blank.
|
||||
|
||||
<root-dir> Name of the directory on the server to mount as root. If
|
||||
there is a "%s" token in the string, the token will be
|
||||
replaced by the ASCII-representation of the client's IP
|
||||
address.
|
||||
|
||||
<nfs-options> Standard NFS options. All options are separated by commas.
|
||||
If the options field is not given, the following defaults
|
||||
will be used:
|
||||
port = as given by server portmap daemon
|
||||
rsize = 1024
|
||||
wsize = 1024
|
||||
timeo = 7
|
||||
retrans = 3
|
||||
acregmin = 3
|
||||
acregmax = 60
|
||||
acdirmin = 30
|
||||
acdirmax = 60
|
||||
flags = hard, nointr, noposix, cto, ac
|
||||
|
||||
root=/dev/nfs
|
||||
|
||||
If you don't use nfsroot= parameter you need to set root=/dev/nfs
|
||||
to boot from a nfs root by autoconfiguration.
|
||||
HELPEOF
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
83
srcpkgs/mkinitcpio-nfs-utils/patches/musl.patch
Normal file
83
srcpkgs/mkinitcpio-nfs-utils/patches/musl.patch
Normal file
|
@ -0,0 +1,83 @@
|
|||
From 9e6dd28c7b2d9649cc3fc3ea9effadcb29d233c5 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Brancaleoni <miwaxe@gmail.com>
|
||||
Date: Thu, 25 Jun 2015 18:01:23 +0200
|
||||
Subject: [PATCH] musl
|
||||
|
||||
---
|
||||
ipconfig/packet.c | 27 +++++++++++++--------------
|
||||
1 file changed, 13 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/ipconfig/packet.c b/ipconfig/packet.c
|
||||
index 446073a..afedf9d 100644
|
||||
--- a/ipconfig/packet.c
|
||||
+++ b/ipconfig/packet.c
|
||||
@@ -7,10 +7,9 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
-#include <net/if_packet.h>
|
||||
+#include <linux/if_packet.h>
|
||||
#include <netinet/if_ether.h>
|
||||
#include <netinet/in.h>
|
||||
-#include <netpacket/packet.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netinet/ip.h>
|
||||
@@ -92,10 +91,10 @@ static struct header ipudp_hdrs = {
|
||||
.daddr = INADDR_BROADCAST,
|
||||
},
|
||||
.udp = {
|
||||
- .source = __constant_htons(LOCAL_PORT),
|
||||
- .dest = __constant_htons(REMOTE_PORT),
|
||||
- .len = 0,
|
||||
- .check = 0,
|
||||
+ .uh_sport = __constant_htons(LOCAL_PORT),
|
||||
+ .uh_dport = __constant_htons(REMOTE_PORT),
|
||||
+ .uh_ulen = 0,
|
||||
+ .uh_sum = 0,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -127,8 +126,8 @@ int packet_send(struct netdev *dev, struct iovec *iov, int iov_len)
|
||||
msg.msg_flags = 0;
|
||||
|
||||
if (cfg_local_port != LOCAL_PORT) {
|
||||
- ipudp_hdrs.udp.source = htons(cfg_local_port);
|
||||
- ipudp_hdrs.udp.dest = htons(cfg_remote_port);
|
||||
+ ipudp_hdrs.udp.uh_sport = htons(cfg_local_port);
|
||||
+ ipudp_hdrs.udp.uh_dport = htons(cfg_remote_port);
|
||||
}
|
||||
|
||||
dprintf("\n udp src %d dst %d", ntohs(ipudp_hdrs.udp.source),
|
||||
@@ -159,7 +158,7 @@ int packet_send(struct netdev *dev, struct iovec *iov, int iov_len)
|
||||
ipudp_hdrs.ip.check = ip_checksum((uint16_t *) &ipudp_hdrs.ip,
|
||||
ipudp_hdrs.ip.ihl);
|
||||
|
||||
- ipudp_hdrs.udp.len = htons(len - sizeof(struct iphdr));
|
||||
+ ipudp_hdrs.udp.uh_ulen = htons(len - sizeof(struct iphdr));
|
||||
|
||||
dprintf("\n bytes %d\n", len);
|
||||
|
||||
@@ -243,14 +242,14 @@ int packet_recv(struct netdev *dev, struct iovec *iov, int iov_len)
|
||||
|
||||
ret -= 4 * ip->ihl;
|
||||
|
||||
- dprintf("\n udp src %d dst %d ", ntohs(udp->source),
|
||||
- ntohs(udp->dest));
|
||||
+ dprintf("\n udp src %d dst %d ", ntohs(udp->uh_sport),
|
||||
+ ntohs(udp->uh_dport));
|
||||
|
||||
- if (udp->source != htons(cfg_remote_port) ||
|
||||
- udp->dest != htons(cfg_local_port))
|
||||
+ if (udp->uh_sport != htons(cfg_remote_port) ||
|
||||
+ udp->uh_dport != htons(cfg_local_port))
|
||||
goto free_pkt;
|
||||
|
||||
- if (ntohs(udp->len) > ret)
|
||||
+ if (ntohs(udp->uh_ulen) > ret)
|
||||
goto free_pkt;
|
||||
|
||||
ret -= sizeof(struct udphdr);
|
||||
--
|
||||
2.4.4
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
--- a/nfsmount/mount.c 2012-11-10 20:16:31.894540497 -0500
|
||||
+++ b/nfsmount/mount.c 2012-11-10 20:16:39.957369011 -0500
|
||||
@@ -358,9 +358,9 @@
|
||||
bail:
|
||||
if (mounted) {
|
||||
if (data->flags & NFS_MOUNT_VER3) {
|
||||
- umount_v3(path, clnt);
|
||||
+ umount_v3(rem_path, clnt);
|
||||
} else {
|
||||
- umount_v2(path, clnt);
|
||||
+ umount_v2(rem_path, clnt);
|
||||
}
|
||||
}
|
||||
|
35
srcpkgs/mkinitcpio-nfs-utils/template
Normal file
35
srcpkgs/mkinitcpio-nfs-utils/template
Normal file
|
@ -0,0 +1,35 @@
|
|||
# Template file for 'mkinitcpio-nfs-utils'
|
||||
pkgname=mkinitcpio-nfs-utils
|
||||
version=0.3
|
||||
revision=1
|
||||
build_style=gnu-makefile
|
||||
short_desc="Ipconfig and nfsmount tools for NFS root support in mkinitcpio"
|
||||
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
|
||||
license="GPL-2"
|
||||
homepage="http://www.archlinux.org/"
|
||||
depends="mkinitcpio"
|
||||
distfiles="https://sources.archlinux.org/other/mkinitcpio/$pkgname-$version.tar.xz"
|
||||
checksum=d290d489844fae100ca7b848b8eef40078124ff373203086bacc07329d1e8939
|
||||
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
*-musl)
|
||||
CFLAGS="-DSYS_NMLN=65"
|
||||
# http://osxr.org/glibc/source/sysdeps/unix/sysv/linux/bits/utsname.h?v=glibc-2.15; fixes musl not having set this variable
|
||||
;;
|
||||
esac
|
||||
|
||||
patch_args="-Np1"
|
||||
|
||||
pre_configure() {
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
*-musl)
|
||||
sed -i 's|PROGRAMS = ipconfig nfsmount|PROGRAMS = ipconfig|g' Makefile
|
||||
# No RPC in musl for now
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
post_install() {
|
||||
vinstall ${FILESDIR}/initcpio-install-net 644 usr/lib/initcpio/install net
|
||||
vinstall ${FILESDIR}/initcpio-hook-net 644 usr/lib/initcpio/hooks net
|
||||
}
|
1
srcpkgs/mkinitcpio-udev
Symbolic link
1
srcpkgs/mkinitcpio-udev
Symbolic link
|
@ -0,0 +1 @@
|
|||
mkinitcpio
|
3
srcpkgs/mkinitcpio/files/11-dm-initramfs.rules
Normal file
3
srcpkgs/mkinitcpio/files/11-dm-initramfs.rules
Normal file
|
@ -0,0 +1,3 @@
|
|||
# needed with new udev/mkinitcpio and as implemented in dracut:
|
||||
# <http://git.kernel.org/?p=boot/dracut/dracut.git;a=commitdiff;h=12b9736228f2b34c15a9cb63be79cf7b6e865b54>
|
||||
SUBSYSTEM=="block", KERNEL=="dm-[0-9]*", ACTION=="add|change", OPTIONS="db_persist"
|
93
srcpkgs/mkinitcpio/files/69-dm-lvm-metad.rules
Normal file
93
srcpkgs/mkinitcpio/files/69-dm-lvm-metad.rules
Normal file
|
@ -0,0 +1,93 @@
|
|||
# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
|
||||
# Udev rules for LVM.
|
||||
#
|
||||
# Scan all block devices having a PV label for LVM metadata.
|
||||
# Store this information in LVMetaD (the LVM metadata daemon) and maintain LVM
|
||||
# metadata state for improved performance by avoiding further scans while
|
||||
# running subsequent LVM commands or while using lvm2app library.
|
||||
# Also, notify LVMetaD about any relevant block device removal.
|
||||
#
|
||||
# This rule is essential for having the information in LVMetaD up-to-date.
|
||||
# It also requires blkid to be called on block devices before so only devices
|
||||
# used as LVM PVs are processed (ID_FS_TYPE="LVM2_member" or "LVM1_member").
|
||||
|
||||
SUBSYSTEM!="block", GOTO="lvm_end"
|
||||
|
||||
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="lvm_end"
|
||||
|
||||
# If the PV label got lost, inform lvmetad immediately.
|
||||
# Detect the lost PV label by comparing previous ID_FS_TYPE value with current one.
|
||||
ENV{.ID_FS_TYPE_NEW}="$env{ID_FS_TYPE}"
|
||||
IMPORT{db}="ID_FS_TYPE"
|
||||
ENV{ID_FS_TYPE}=="LVM2_member|LVM1_member", ENV{.ID_FS_TYPE_NEW}!="LVM2_member|LVM1_member", ENV{LVM_PV_GONE}="1"
|
||||
ENV{ID_FS_TYPE}="$env{.ID_FS_TYPE_NEW}"
|
||||
ENV{LVM_PV_GONE}=="1", GOTO="lvm_scan"
|
||||
|
||||
# Only process devices already marked as a PV - this requires blkid to be called before.
|
||||
ENV{ID_FS_TYPE}!="LVM2_member|LVM1_member", GOTO="lvm_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
|
||||
|
||||
# Inform lvmetad about any PV that is gone.
|
||||
ACTION=="remove", GOTO="lvm_scan"
|
||||
|
||||
# Create /dev/disk/by-id/lvm-pv-uuid-<PV_UUID> symlink for each PV
|
||||
ENV{ID_FS_UUID_ENC}=="?*", SYMLINK+="disk/by-id/lvm-pv-uuid-$env{ID_FS_UUID_ENC}"
|
||||
|
||||
# If the PV is a special device listed below, scan only if the device is
|
||||
# properly activated. These devices are not usable after an ADD event,
|
||||
# but they require an extra setup and they are ready after a CHANGE event.
|
||||
# Also support coldplugging with ADD event but only if the device is already
|
||||
# properly activated.
|
||||
# This logic should be eventually moved to rules where those particular
|
||||
# devices are processed primarily (MD and loop).
|
||||
|
||||
# DM device:
|
||||
KERNEL!="dm-[0-9]*", GOTO="next"
|
||||
ENV{DM_UDEV_PRIMARY_SOURCE_FLAG}=="1", ENV{DM_ACTIVATION}=="1", GOTO="lvm_scan"
|
||||
GOTO="lvm_end"
|
||||
|
||||
# MD device:
|
||||
LABEL="next"
|
||||
KERNEL!="md[0-9]*", GOTO="next"
|
||||
IMPORT{db}="LVM_MD_PV_ACTIVATED"
|
||||
ACTION=="add", ENV{LVM_MD_PV_ACTIVATED}=="1", GOTO="lvm_scan"
|
||||
ACTION=="change", ENV{LVM_MD_PV_ACTIVATED}!="1", TEST=="md/array_state", ENV{LVM_MD_PV_ACTIVATED}="1", GOTO="lvm_scan"
|
||||
ACTION=="add", KERNEL=="md[0-9]*p[0-9]*", GOTO="lvm_scan"
|
||||
ENV{LVM_MD_PV_ACTIVATED}!="1", ENV{SYSTEMD_READY}="0"
|
||||
GOTO="lvm_end"
|
||||
|
||||
# Loop device:
|
||||
LABEL="next"
|
||||
KERNEL!="loop[0-9]*", GOTO="next"
|
||||
ACTION=="add", ENV{LVM_LOOP_PV_ACTIVATED}=="1", GOTO="lvm_scan"
|
||||
ACTION=="change", ENV{LVM_LOOP_PV_ACTIVATED}!="1", TEST=="loop/backing_file", ENV{LVM_LOOP_PV_ACTIVATED}="1", GOTO="lvm_scan"
|
||||
ENV{LVM_LOOP_PV_ACTIVATED}!="1", ENV{SYSTEMD_READY}="0"
|
||||
GOTO="lvm_end"
|
||||
|
||||
# If the PV is not a special device listed above, scan only after device addition (ADD event)
|
||||
LABEL="next"
|
||||
ACTION!="add", GOTO="lvm_end"
|
||||
|
||||
LABEL="lvm_scan"
|
||||
|
||||
# The table below summarises the situations in which we reach the LABEL="lvm_scan".
|
||||
# Marked by X, X* means only if the special dev is properly set up.
|
||||
# The artificial ADD is supported for coldplugging. We avoid running the pvscan
|
||||
# on artificial CHANGE so there's no unexpected autoactivation when WATCH rule fires.
|
||||
# N.B. MD and loop never actually reaches lvm_scan on REMOVE as the PV label is gone
|
||||
# within a CHANGE event (these are caught by the "LVM_PV_GONE" rule at the beginning).
|
||||
#
|
||||
# | real ADD | real CHANGE | artificial ADD | artificial CHANGE | REMOVE
|
||||
# =============================================================================
|
||||
# DM | | X | X* | | X
|
||||
# MD | | X | X* | |
|
||||
# loop | | X | X* | |
|
||||
# other | X | | X | | X
|
||||
ENV{SYSTEMD_READY}="1"
|
||||
RUN+="/usr/bin/lvm pvscan --background --cache --activate ay --major $major --minor $minor", ENV{LVM_SCANNED}="1"
|
||||
|
||||
LABEL="lvm_end"
|
139
srcpkgs/mkinitcpio/files/encrypt_hook
Normal file
139
srcpkgs/mkinitcpio/files/encrypt_hook
Normal file
|
@ -0,0 +1,139 @@
|
|||
#!/usr/bin/ash
|
||||
|
||||
run_hook() {
|
||||
modprobe -a -q dm-crypt >/dev/null 2>&1
|
||||
[ "${quiet}" = "y" ] && CSQUIET=">/dev/null"
|
||||
|
||||
# Get keyfile if specified
|
||||
ckeyfile="/crypto_keyfile.bin"
|
||||
if [ -n "$cryptkey" ]; then
|
||||
IFS=: read ckdev ckarg1 ckarg2 <<EOF
|
||||
$cryptkey
|
||||
EOF
|
||||
|
||||
if [ "$ckdev" = "rootfs" ]; then
|
||||
ckeyfile=$ckarg1
|
||||
elif resolved=$(resolve_device "${ckdev}" ${rootdelay}); then
|
||||
case ${ckarg1} in
|
||||
*[!0-9]*)
|
||||
# Use a file on the device
|
||||
# ckarg1 is not numeric: ckarg1=filesystem, ckarg2=path
|
||||
mkdir /ckey
|
||||
mount -r -t "$ckarg1" "$resolved" /ckey
|
||||
dd if="/ckey/$ckarg2" of="$ckeyfile" >/dev/null 2>&1
|
||||
umount /ckey
|
||||
;;
|
||||
*)
|
||||
# Read raw data from the block device
|
||||
# ckarg1 is numeric: ckarg1=offset, ckarg2=length
|
||||
dd if="$resolved" of="$ckeyfile" bs=1 skip="$ckarg1" count="$ckarg2" >/dev/null 2>&1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
[ ! -f ${ckeyfile} ] && echo "Keyfile could not be opened. Reverting to passphrase."
|
||||
fi
|
||||
|
||||
if [ -n "${cryptdevice}" ]; then
|
||||
DEPRECATED_CRYPT=0
|
||||
IFS=: read cryptdev cryptname cryptoptions <<EOF
|
||||
$cryptdevice
|
||||
EOF
|
||||
else
|
||||
DEPRECATED_CRYPT=1
|
||||
cryptdev="${root}"
|
||||
cryptname="root"
|
||||
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."
|
||||
}
|
||||
|
||||
for cryptopt in ${cryptoptions//,/ }; do
|
||||
case ${cryptopt} in
|
||||
allow-discards)
|
||||
cryptargs="${cryptargs} --allow-discards"
|
||||
;;
|
||||
*)
|
||||
echo "Encryption option '${cryptopt}' not known, ignoring." >&2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if resolved=$(resolve_device "${cryptdev}" ${rootdelay}); then
|
||||
if cryptsetup isLuks ${resolved} >/dev/null 2>&1; then
|
||||
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
|
||||
dopassphrase=1
|
||||
# If keyfile exists, try to use that
|
||||
if [ -f ${ckeyfile} ]; then
|
||||
if eval cryptsetup --key-file ${ckeyfile} open --type luks ${resolved} ${cryptname} ${cryptargs} ${CSQUIET}; then
|
||||
dopassphrase=0
|
||||
else
|
||||
echo "Invalid keyfile. Reverting to passphrase."
|
||||
fi
|
||||
fi
|
||||
# Ask for a passphrase
|
||||
if [ ${dopassphrase} -gt 0 ]; then
|
||||
echo ""
|
||||
echo "A password is required to access the ${cryptname} volume:"
|
||||
|
||||
#loop until we get a real password
|
||||
while ! eval cryptsetup open --type luks ${resolved} ${cryptname} ${cryptargs} ${CSQUIET}; do
|
||||
sleep 2;
|
||||
done
|
||||
fi
|
||||
if [ -e "/dev/mapper/${cryptname}" ]; then
|
||||
if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
|
||||
export root="/dev/mapper/root"
|
||||
fi
|
||||
else
|
||||
err "Password succeeded, but ${cryptname} creation failed, aborting..."
|
||||
exit 1
|
||||
fi
|
||||
elif [ -n "${crypto}" ]; then
|
||||
[ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated
|
||||
msg "Non-LUKS encrypted device found..."
|
||||
if echo "$crypto" | awk -F: '{ exit(NF == 5) }'; then
|
||||
err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip"
|
||||
err "Non-LUKS decryption not attempted..."
|
||||
return 1
|
||||
fi
|
||||
exe="cryptsetup open --type plain $resolved $cryptname $cryptargs"
|
||||
IFS=: read c_hash c_cipher c_keysize c_offset c_skip <<EOF
|
||||
$crypto
|
||||
EOF
|
||||
[ -n "$c_hash" ] && exe="$exe --hash '$c_hash'"
|
||||
[ -n "$c_cipher" ] && exe="$exe --cipher '$c_cipher'"
|
||||
[ -n "$c_keysize" ] && exe="$exe --key-size '$c_keysize'"
|
||||
[ -n "$c_offset" ] && exe="$exe --offset '$c_offset'"
|
||||
[ -n "$c_skip" ] && exe="$exe --skip '$c_skip'"
|
||||
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
|
||||
eval "$exe $CSQUIET"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
err "Non-LUKS device decryption failed. verify format: "
|
||||
err " crypto=hash:cipher:keysize:offset:skip"
|
||||
exit 1
|
||||
fi
|
||||
if [ -e "/dev/mapper/${cryptname}" ]; then
|
||||
if [ ${DEPRECATED_CRYPT} -eq 1 ]; then
|
||||
export root="/dev/mapper/root"
|
||||
fi
|
||||
else
|
||||
err "Password succeeded, but ${cryptname} creation failed, aborting..."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
err "Failed to open encryption mapping: The device ${cryptdev} is not a LUKS volume and the crypto= paramater was not specified."
|
||||
fi
|
||||
fi
|
||||
rm -f ${ckeyfile}
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
44
srcpkgs/mkinitcpio/files/encrypt_install
Normal file
44
srcpkgs/mkinitcpio/files/encrypt_install
Normal file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/bash
|
||||
|
||||
build() {
|
||||
local mod
|
||||
|
||||
add_module dm-crypt
|
||||
if [[ $CRYPTO_MODULES ]]; then
|
||||
for mod in $CRYPTO_MODULES; do
|
||||
add_module "$mod"
|
||||
done
|
||||
else
|
||||
add_all_modules '/crypto/'
|
||||
fi
|
||||
|
||||
add_binary "cryptsetup"
|
||||
add_binary "dmsetup"
|
||||
add_file "/usr/lib/udev/rules.d/10-dm.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/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules"
|
||||
|
||||
add_runscript
|
||||
}
|
||||
|
||||
help() {
|
||||
cat <<HELPEOF
|
||||
This hook allows for an encrypted root device. Users should specify the device
|
||||
to be unlocked using 'cryptdevice=device:dmname' on the kernel command line,
|
||||
where 'device' is the path to the raw device, and 'dmname' is the name given to
|
||||
the device after unlocking, and will be available as /dev/mapper/dmname.
|
||||
|
||||
For unlocking via keyfile, 'cryptkey=device:fstype:path' should be specified on
|
||||
the kernel cmdline, where 'device' represents the raw block device where the key
|
||||
exists, 'fstype' is the filesystem type of 'device' (or auto), and 'path' is
|
||||
the absolute path of the keyfile within the device.
|
||||
|
||||
Without specifying a keyfile, you will be prompted for the password at runtime.
|
||||
This means you must have a keyboard available to input it, and you may need
|
||||
the keymap hook as well to ensure that the keyboard is using the layout you
|
||||
expect.
|
||||
HELPEOF
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
15
srcpkgs/mkinitcpio/files/kernel-hook-postinst
Normal file
15
srcpkgs/mkinitcpio/files/kernel-hook-postinst
Normal file
|
@ -0,0 +1,15 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Kernel post-install hook for mkinitcpio.
|
||||
#
|
||||
# Arguments passed to this script: $1 pkgname, $2 version.
|
||||
#
|
||||
PKGNAME="$1"
|
||||
VERSION="$2"
|
||||
|
||||
if [ ! -x bin/mkinitcpio ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
mkinitcpio -g boot/initramfs-${VERSION}.img -k ${VERSION}
|
||||
exit $?
|
13
srcpkgs/mkinitcpio/files/kernel-hook-postrm
Normal file
13
srcpkgs/mkinitcpio/files/kernel-hook-postrm
Normal file
|
@ -0,0 +1,13 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Kernel post-remove hook for mkinitcpio.
|
||||
#
|
||||
# Arguments passed to this script: $1 pkgname, $2 version.
|
||||
#
|
||||
PKGNAME="$1"
|
||||
VERSION="$2"
|
||||
|
||||
if [ -f /boot/initramfs-${VERSION}.img ]; then
|
||||
rm -f /boot/initramfs-${VERSION}.img
|
||||
fi
|
||||
exit $?
|
1587
srcpkgs/mkinitcpio/files/lvm.conf
Normal file
1587
srcpkgs/mkinitcpio/files/lvm.conf
Normal file
File diff suppressed because it is too large
Load diff
12
srcpkgs/mkinitcpio/files/lvm2_hook
Normal file
12
srcpkgs/mkinitcpio/files/lvm2_hook
Normal file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/ash
|
||||
|
||||
run_earlyhook() {
|
||||
mkdir /run/lvm
|
||||
lvmetad
|
||||
}
|
||||
|
||||
run_cleanuphook() {
|
||||
kill $(cat /run/lvmetad.pid)
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
34
srcpkgs/mkinitcpio/files/lvm2_install
Normal file
34
srcpkgs/mkinitcpio/files/lvm2_install
Normal file
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/bash
|
||||
|
||||
build() {
|
||||
local mod
|
||||
for mod in dm-mod dm-snapshot dm-mirror dm-cache dm-cache-mq; 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"
|
||||
add_file "/usr/lib/udev/rules.d/10-dm.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/conf/lvm.conf" "/etc/lvm/lvm.conf"
|
||||
|
||||
add_runscript
|
||||
}
|
||||
|
||||
help() {
|
||||
cat <<HELPEOF
|
||||
This hook enables LVM2 volumes in initramfs.
|
||||
HELPEOF
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
49
srcpkgs/mkinitcpio/files/mdadm_hook
Normal file
49
srcpkgs/mkinitcpio/files/mdadm_hook
Normal file
|
@ -0,0 +1,49 @@
|
|||
#!/usr/bin/ash
|
||||
|
||||
run_hook() {
|
||||
local i= mdconfig=/etc/mdadm.conf
|
||||
|
||||
# for partitionable raid, we need to load md_mod first!
|
||||
modprobe md_mod 2>/dev/null
|
||||
|
||||
if [ -n "$md" ]; then
|
||||
echo 'DEVICE partitions' >"$mdconfig"
|
||||
for i in $(cat /proc/cmdline); do
|
||||
case $i in
|
||||
# raid
|
||||
md=[0-9]*,/*)
|
||||
device=${i%%,*}
|
||||
device=${device/=/}
|
||||
array=${i#*,}
|
||||
echo "ARRAY /dev/$device devices=$array"
|
||||
;;
|
||||
# partitionable raid
|
||||
md=d[0-9]*,/*)
|
||||
device=${i%%,*}
|
||||
device=${device/=/_}
|
||||
array=${i#*,}
|
||||
echo "ARRAY /dev/$device devices=$array"
|
||||
;;
|
||||
# raid UUID
|
||||
md=[0-9]*,[0-9,a-fA-F]*)
|
||||
device=${i%%,*}
|
||||
device=${device/=/}
|
||||
array=${i#*,}
|
||||
echo "ARRAY /dev/$device UUID=$array"
|
||||
;;
|
||||
# partitionable raid UUID
|
||||
md=d[0-9]*,[0-9,a-fA-F]*)
|
||||
device=${i%%,*}
|
||||
device=${device/=/_}
|
||||
array=${i#*,}
|
||||
echo "ARRAY /dev/$device UUID=$array"
|
||||
;;
|
||||
esac
|
||||
done >>"$mdconfig"
|
||||
fi
|
||||
|
||||
# assemble everything
|
||||
[ -s "$mdconfig" ] && /usr/bin/mdassemble
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
46
srcpkgs/mkinitcpio/files/mdadm_install
Normal file
46
srcpkgs/mkinitcpio/files/mdadm_install
Normal file
|
@ -0,0 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
build() {
|
||||
add_checked_modules -f 'dm-' 'drivers/md/*'
|
||||
|
||||
# check if a custom mdadm.conf exists
|
||||
if grep -q ^ARRAY /etc/mdadm.conf; then
|
||||
echo "Custom /etc/mdadm.conf file will be used in initramfs for assembling arrays."
|
||||
add_file "/etc/mdadm.conf"
|
||||
fi
|
||||
add_binary "/usr/bin/mdassemble"
|
||||
add_file "/usr/lib/udev/rules.d/63-md-raid-arrays.rules"
|
||||
|
||||
add_runscript
|
||||
}
|
||||
|
||||
help() {
|
||||
cat <<HELPEOF
|
||||
This hook loads the necessary modules for any raid root device,
|
||||
and assembles the raid device when run.
|
||||
|
||||
If arrays are defined in /etc/mdadm.conf, the file will be used instead
|
||||
of command line assembling.
|
||||
|
||||
Command Line Setup:
|
||||
- for raid arrays with persistent superblocks:
|
||||
md=<md device no.>,dev0,dev1,...,devn
|
||||
md=<md device no.>,uuid
|
||||
- for partitionable raid arrays with persistent superblocks:
|
||||
md=d<md device no.>,dev0,dev1,...,devn
|
||||
md=d<md device no.>,uuid
|
||||
|
||||
Parameters:
|
||||
- <md device no.> = the number of the md device:
|
||||
0 means md0, 1 means md1, ...
|
||||
- <dev0-devn>: e.g. /dev/hda1,/dev/hdc1,/dev/sda1,/dev/sdb1
|
||||
or 0900878d:f95f6057:c39a36e9:55efa60a
|
||||
Examples:
|
||||
- md=d0,/dev/sda3,/dev/sda4 md=d1,/dev/hda1,/dev/hdb1
|
||||
This will setup 2 md partitionable arrays.
|
||||
- md=0,/dev/sda3,/dev/sda4 md=1,/dev/hda1,/dev/hdb1
|
||||
This will setup 2 md arrays with persistent superblocks.
|
||||
HELPEOF
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
25
srcpkgs/mkinitcpio/files/mdadm_udev_install
Normal file
25
srcpkgs/mkinitcpio/files/mdadm_udev_install
Normal file
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash
|
||||
|
||||
build() {
|
||||
add_checked_modules -f 'dm-' 'drivers/md/*'
|
||||
|
||||
# check if a custom mdadm.conf exists
|
||||
if grep -qw ^ARRAY "$BASEDIR/etc/mdadm.conf"; then
|
||||
echo "Custom /etc/mdadm.conf file will be used in initramfs for assembling arrays."
|
||||
add_file "/etc/mdadm.conf"
|
||||
fi
|
||||
|
||||
add_binary "/usr/bin/mdadm"
|
||||
add_file "/usr/lib/udev/rules.d/63-md-raid-arrays.rules"
|
||||
add_file "/usr/lib/udev/rules.d/64-md-raid-assembly.rules"
|
||||
}
|
||||
|
||||
help() {
|
||||
cat <<HELPEOF
|
||||
This hook loads the necessary modules for a RAID array and uses incremental
|
||||
assembly via udev at runtime to create the devices. This hook will NOT work
|
||||
without the udev hook included on the image.
|
||||
HELPEOF
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
20
srcpkgs/mkinitcpio/files/udev_hook
Normal file
20
srcpkgs/mkinitcpio/files/udev_hook
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/ash
|
||||
|
||||
run_earlyhook() {
|
||||
udevd --daemon --resolve-names=never
|
||||
udevd_running=1
|
||||
}
|
||||
|
||||
run_hook() {
|
||||
msg ":: Triggering uevents..."
|
||||
udevadm trigger --action=add --type=subsystems
|
||||
udevadm trigger --action=add --type=devices
|
||||
udevadm settle
|
||||
}
|
||||
|
||||
run_cleanuphook() {
|
||||
udevadm control --exit
|
||||
udevadm info --cleanup-db
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
27
srcpkgs/mkinitcpio/files/udev_install
Normal file
27
srcpkgs/mkinitcpio/files/udev_install
Normal file
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
build() {
|
||||
add_file "/etc/udev/udev.conf"
|
||||
add_binary /usr/bin/udevd
|
||||
add_binary /usr/bin/udevadm
|
||||
|
||||
for rule in 50-udev-default.rules 60-persistent-storage.rules 64-btrfs.rules 80-drivers.rules; do
|
||||
add_file "/usr/lib/udev/rules.d/$rule"
|
||||
done
|
||||
|
||||
for tool in ata_id scsi_id; do
|
||||
add_file "/usr/lib/udev/$tool"
|
||||
done
|
||||
|
||||
add_runscript
|
||||
}
|
||||
|
||||
help() {
|
||||
cat <<HELPEOF
|
||||
This hook will use udev to create your root device node and detect the needed
|
||||
modules for your root device. It is also required for firmware loading in
|
||||
initramfs. It is recommended to use this hook.
|
||||
HELPEOF
|
||||
}
|
||||
|
||||
# vim: set ft=sh ts=4 sw=4 et:
|
|
@ -0,0 +1,39 @@
|
|||
From ea4c4154205372154457c794513ae46b61ea4e4c Mon Sep 17 00:00:00 2001
|
||||
From: Dave Reisner <dreisner@archlinux.org>
|
||||
Date: Mon, 4 Aug 2014 08:31:37 -0400
|
||||
Subject: [mkinitcpio] [PATCH] avoid compound conditional leading to spurious
|
||||
"errors"
|
||||
|
||||
As seen:
|
||||
|
||||
https://bbs.archlinux.org/viewtopic.php?id=185204
|
||||
https://bbs.archlinux.org/viewtopic.php?id=185265
|
||||
---
|
||||
functions | 8 ++++++--
|
||||
1 file changed, 6 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/functions b/functions
|
||||
index 20bbffe..362d07b 100644
|
||||
--- a/functions
|
||||
+++ b/functions
|
||||
@@ -423,11 +423,15 @@ add_full_dir() {
|
||||
|
||||
for f in "$1"/*; do
|
||||
if [[ -L $f ]]; then
|
||||
- [[ $f = $filter ]] && add_symlink "$f" "$(readlink "$f")"
|
||||
+ if [[ $f = $filter ]]; then
|
||||
+ add_symlink "$f" "$(readlink "$f")"
|
||||
+ fi
|
||||
elif [[ -d $f ]]; then
|
||||
add_full_dir "$f"
|
||||
elif [[ -f $f ]]; then
|
||||
- [[ $f = $filter ]] && add_file "$f"
|
||||
+ if [[ $f = $filter ]]; then
|
||||
+ add_file "$f"
|
||||
+ fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
--
|
||||
2.1.0
|
||||
|
25
srcpkgs/mkinitcpio/patches/default-to-runit-init.patch
Normal file
25
srcpkgs/mkinitcpio/patches/default-to-runit-init.patch
Normal file
|
@ -0,0 +1,25 @@
|
|||
From 6a100b4a4a709f177f383988079a2a3c3ada08b8 Mon Sep 17 00:00:00 2001
|
||||
From: Andrea Brancaleoni <miwaxe@gmail.com>
|
||||
Date: Thu, 25 Jun 2015 01:59:58 +0200
|
||||
Subject: [PATCH] default to runit-init
|
||||
|
||||
---
|
||||
init | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/init b/init
|
||||
index 4891ed8..7534d23 100644
|
||||
--- a/init
|
||||
+++ b/init
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
udevd_running=0
|
||||
mount_handler=default_mount_handler
|
||||
-init=/sbin/init
|
||||
+init=/usr/bin/runit-init
|
||||
rd_logmask=0
|
||||
|
||||
. /init_functions
|
||||
--
|
||||
2.4.4
|
||||
|
67
srcpkgs/mkinitcpio/template
Normal file
67
srcpkgs/mkinitcpio/template
Normal file
|
@ -0,0 +1,67 @@
|
|||
# Template file for 'mkinitcpio'
|
||||
pkgname=mkinitcpio
|
||||
version=18
|
||||
revision=1
|
||||
noarch=yes
|
||||
build_style=gnu-makefile
|
||||
depends="busybox-static bsdcpio"
|
||||
short_desc="Next generation of initramfs creation"
|
||||
maintainer="Andrea Brancaleoni <miwaxe@gmail.com>"
|
||||
license="GPL-2"
|
||||
homepage="https://wiki.archlinux.org/index.php/Mkinitcpio"
|
||||
distfiles="https://sources.archlinux.org/other/$pkgname/$pkgname-$version.tar.gz"
|
||||
checksum=187bdeeade08996010fbff480ccc91e47722d275c22fd6feb4a4b63061e9fc22
|
||||
|
||||
conf_files="/etc/mkinitcpio.conf"
|
||||
|
||||
patch_args="-Np1"
|
||||
|
||||
post_install() {
|
||||
ln -s /usr/bin/busybox.static $DESTDIR/usr/lib/initcpio/busybox
|
||||
|
||||
vinstall ${FILESDIR}/kernel-hook-postinst 755 etc/kernel.d/post-install 20-mkinitcpio
|
||||
vinstall ${FILESDIR}/kernel-hook-postrm 755 etc/kernel.d/post-remove 20-mkinitcpio
|
||||
}
|
||||
|
||||
mkinitcpio-udev_package() {
|
||||
depends="${sourcepkg}>=${version}_${revision} eudev"
|
||||
short_desc+=" - udev support"
|
||||
pkg_install() {
|
||||
vinstall ${FILESDIR}/udev_hook 644 usr/lib/initcpio/hooks udev
|
||||
vinstall ${FILESDIR}/udev_install 644 usr/lib/initcpio/install udev
|
||||
}
|
||||
}
|
||||
|
||||
mkinitcpio-lvm2_package() {
|
||||
depends="${sourcepkg}>=${version}_${revision} lvm2 thin-provisioning-tools"
|
||||
short_desc+=" - lvm2 support"
|
||||
conf_files="/usr/lib/initcpio/conf/lvm.conf"
|
||||
pkg_install() {
|
||||
vinstall ${FILESDIR}/lvm2_hook 644 usr/lib/initcpio/hooks lvm2
|
||||
vinstall ${FILESDIR}/lvm2_install 644 usr/lib/initcpio/install lvm2
|
||||
for RULES in ${FILESDIR}/*.rules; do
|
||||
vinstall $RULES 644 usr/lib/initcpio/udev $(basename $RULES)
|
||||
done
|
||||
vinstall ${FILESDIR}/lvm.conf 644 usr/lib/initcpio/conf
|
||||
}
|
||||
}
|
||||
|
||||
mkinitcpio-encrypt_package() {
|
||||
depends="${sourcepkg}>=${version}_${revision}
|
||||
${sourcepkg}-lvm2>=${version}_${revision} cryptsetup"
|
||||
short_desc+=" - encrypt support"
|
||||
pkg_install() {
|
||||
vinstall ${FILESDIR}/encrypt_hook 644 usr/lib/initcpio/hooks encrypt
|
||||
vinstall ${FILESDIR}/encrypt_install 644 usr/lib/initcpio/install encrypt
|
||||
}
|
||||
}
|
||||
|
||||
mkinitcpio-mdadm_package() {
|
||||
depends="${sourcepkg}>=${version}_${revision} mdadm"
|
||||
short_desc+=" - mdadm support"
|
||||
pkg_install() {
|
||||
vinstall ${FILESDIR}/mdadm_hook 644 usr/lib/initcpio/hooks mdadm
|
||||
vinstall ${FILESDIR}/mdadm_install 644 usr/lib/initcpio/install mdadm
|
||||
vinstall ${FILESDIR}/mdadm_udev_install 644 usr/lib/initcpio/install mdadm_udev
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue