aboutsummaryrefslogtreecommitdiffstats
path: root/main/mkinitfs/0001-mkinitfs-add-K-flag-to-copy-host-keys-to-new-initram.patch
blob: 23c59a1b9e971f74ae2596e9107bb8ef88caed37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 3e2519f2930a318ef06ffb8bac01bae6fc1ee218 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
Date: Wed, 13 Jul 2016 14:49:28 +0000
Subject: [PATCH 1/4] mkinitfs: add -K flag to copy host keys to new initramfs

this is mainly to copy the developer keys present on build system
to the target initramfs. simplifies creating your own initramfs
and when your key is not packaged.
---
 mkinitfs.in | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/mkinitfs.in b/mkinitfs.in
index 555bea8..d69ccc5 100755
--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -133,6 +133,7 @@ initfs_firmware() {
 
 initfs_apk_keys() {
 	mkdir -p "$tmpdir"/etc/apk/keys
+	[ "$hostkeys" ] && cp "/etc/apk/keys/"* "$tmpdir"/etc/apk/keys/
 	cp "${basedir}etc/apk/keys/"* "$tmpdir"/etc/apk/keys/
 }
 
@@ -148,7 +149,7 @@ initfs_cpio() {
 
 usage() {
 	cat <<EOF
-usage: mkinitfs [-hkLl] [-b basedir] [-c configfile] [-F features] [-f fstab]
+usage: mkinitfs [-hkKLl] [-b basedir] [-c configfile] [-F features] [-f fstab]
 		[-i initfile ] [-o outfile] [-t tempdir] [kernelversion]"
 options:
 	-b  prefix files and kernel modules with basedir
@@ -158,6 +159,7 @@ options:
 	-h  print this help
 	-i  use initfile as init instead of $init
 	-k  keep tempdir
+	-K  copy also host keys to initramfs
 	-l  only list files that would have been used
 	-L  list available features
 	-o  set another outfile
@@ -171,7 +173,7 @@ EOF
 # main
 
 
-while getopts "b:c:f:F:hi:kLlo:qt:" opt; do
+while getopts "b:c:f:F:hi:kKLlo:qt:" opt; do
 	case "$opt" in
 		b) basedir="$OPTARG";;
 		c) config="$OPTARG";;
@@ -180,6 +182,7 @@ while getopts "b:c:f:F:hi:kLlo:qt:" opt; do
 		h) usage;;
 		i) init=$OPTARG;;
 		k) keeptmp=1;;
+		K) hostkeys=1;;
 		L) list_features=1;;
 		l) list_sources=1;;
 		o) outfile="$OPTARG";;
-- 
2.9.3