1 |
commit: 4f9a09147887a6d108a8e55ab47a53d1016efee9 |
2 |
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Aug 28 19:35:33 2020 +0000 |
4 |
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Aug 28 19:35:33 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=4f9a0914 |
7 |
|
8 |
gen_initramfs.sh: append_base_layout(): Create /etc/{group,passwd,shadow} in this function |
9 |
|
10 |
These files should be present all the time, not just when built with --ssh option set. |
11 |
|
12 |
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org> |
13 |
|
14 |
gen_initramfs.sh | 75 +++++++++++++++++++++++++++++++++++++++++++------------- |
15 |
1 file changed, 58 insertions(+), 17 deletions(-) |
16 |
|
17 |
diff --git a/gen_initramfs.sh b/gen_initramfs.sh |
18 |
index fcfa827..ae71c38 100755 |
19 |
--- a/gen_initramfs.sh |
20 |
+++ b/gen_initramfs.sh |
21 |
@@ -302,6 +302,7 @@ append_base_layout() { |
22 |
usr/bin \ |
23 |
usr/lib \ |
24 |
usr/sbin \ |
25 |
+ var/empty \ |
26 |
var/log \ |
27 |
var/run/lock \ |
28 |
; do |
29 |
@@ -333,6 +334,63 @@ append_base_layout() { |
30 |
echo "proc /proc proc defaults 0 0" >> "${TDIR}"/etc/fstab \ |
31 |
|| gen_die "Failed to add proc to '${TDIR}/etc/fstab'!" |
32 |
|
33 |
+ print_info 2 "$(get_indent 2)>> Adding /etc/{group,passwd,shadow} ..." |
34 |
+ cat >"${TDIR}"/etc/group <<-EOF |
35 |
+ root:x:0:root |
36 |
+ bin:x:1:root,bin,daemon |
37 |
+ daemon:x:2:root,bin,daemon |
38 |
+ sys:x:3:root,bin,adm |
39 |
+ adm:x:4:root,adm,daemon |
40 |
+ tty:x:5: |
41 |
+ disk:x:6:root,adm |
42 |
+ lp:x:7:lp |
43 |
+ mem:x:8: |
44 |
+ kmem:x:9: |
45 |
+ wheel:x:10:root |
46 |
+ floppy:x:11:root |
47 |
+ news:x:13:news |
48 |
+ uucp:x:14:uucp |
49 |
+ console:x:17: |
50 |
+ audio:x:18: |
51 |
+ cdrom:x:19: |
52 |
+ dialout:x:20: |
53 |
+ tape:x:26:root |
54 |
+ video:x:27:root |
55 |
+ render:x:28: |
56 |
+ rpc:x:32: |
57 |
+ kvm:x:78: |
58 |
+ usb:x:85: |
59 |
+ input:x:97: |
60 |
+ utmp:x:406: |
61 |
+ nogroup:x:65533: |
62 |
+ nobody:x:65534: |
63 |
+ EOF |
64 |
+ |
65 |
+ chmod 0644 "${TDIR}"/etc/group \ |
66 |
+ || gen_die "Failed to chmod of '${TDIR}/etc/group'!" |
67 |
+ |
68 |
+ cat >"${TDIR}"/etc/passwd <<-EOF |
69 |
+ root:x:0:0:root:/root:/usr/bin/login-remote.sh |
70 |
+ nobody:x:65534:65534:nobody:/var/empty:/bin/false |
71 |
+ EOF |
72 |
+ |
73 |
+ chmod 0644 "${TDIR}"/etc/passwd \ |
74 |
+ || gen_die "Failed to chmod of '${TDIR}/etc/passwd'!" |
75 |
+ |
76 |
+ echo "root:!:0:0:99999:7:::" > "${TDIR}"/etc/shadow \ |
77 |
+ || gen_die "Failed to create '/etc/shadow'!" |
78 |
+ |
79 |
+ chmod 0640 "${TDIR}"/etc/shadow \ |
80 |
+ || gen_die "Failed to chmod of '${TDIR}/etc/shadow'!" |
81 |
+ |
82 |
+ print_info 2 "$(get_indent 2)>> Adding /etc/nsswitch.conf ..." |
83 |
+ cat >"${TDIR}"/etc/nsswitch.conf <<-EOF |
84 |
+ # /etc/nsswitch.conf generated by genkernel |
85 |
+ passwd: files |
86 |
+ shadow: files |
87 |
+ group: files |
88 |
+ EOF |
89 |
+ |
90 |
print_info 2 "$(get_indent 2)>> Adding /etc/ld.so.conf ..." |
91 |
cat >"${TDIR}"/etc/ld.so.conf <<-EOF |
92 |
# ld.so.conf generated by genkernel |
93 |
@@ -1548,18 +1606,10 @@ append_dropbear() { |
94 |
cp -aL /etc/localtime "${TDIR}"/etc/ \ |
95 |
|| gen_die "Failed to copy '/etc/localtime'. Please set system's timezone!" |
96 |
|
97 |
- echo "root:x:0:0:root:/root:/usr/bin/login-remote.sh" > "${TDIR}"/etc/passwd \ |
98 |
- || gen_die "Failed to create '/etc/passwd'!" |
99 |
|
100 |
echo "/usr/bin/login-remote.sh" > "${TDIR}"/etc/shells \ |
101 |
|| gen_die "Failed to create '/etc/shells'!" |
102 |
|
103 |
- echo "root:!:0:0:99999:7:::" > "${TDIR}"/etc/shadow \ |
104 |
- || gen_die "Failed to create '/etc/shadow'!" |
105 |
- |
106 |
- echo "root:x:0:root" > "${TDIR}"/etc/group \ |
107 |
- || gen_die "Failed to create '/etc/group'!" |
108 |
- |
109 |
chmod 0755 "${TDIR}"/usr/bin/login-remote.sh \ |
110 |
|| gen_die "Failed to chmod of '${TDIR}/usr/bin/login-remote.sh'!" |
111 |
|
112 |
@@ -1572,15 +1622,6 @@ append_dropbear() { |
113 |
chmod 0755 "${TDIR}"/usr/sbin/unlock-zfs \ |
114 |
|| gen_die "Failed to chmod of '${TDIR}/usr/sbin/unlock-zfs'!" |
115 |
|
116 |
- chmod 0640 "${TDIR}"/etc/shadow \ |
117 |
- || gen_die "Failed to chmod of '${TDIR}/etc/shadow'!" |
118 |
- |
119 |
- chmod 0644 "${TDIR}"/etc/passwd \ |
120 |
- || gen_die "Failed to chmod of '${TDIR}/etc/passwd'!" |
121 |
- |
122 |
- chmod 0644 "${TDIR}"/etc/group \ |
123 |
- || gen_die "Failed to chmod of '${TDIR}/etc/group'!" |
124 |
- |
125 |
cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!" |
126 |
log_future_cpio_content |
127 |
find . -print0 | "${CPIO_COMMAND}" ${CPIO_ARGS} --append -F "${CPIO_ARCHIVE}" \ |