From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 76C68138359 for ; Fri, 28 Aug 2020 20:18:58 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7F415E0AAB; Fri, 28 Aug 2020 20:18:52 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 3001FE0AA4 for ; Fri, 28 Aug 2020 20:18:52 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 6E933340B65 for ; Fri, 28 Aug 2020 20:18:51 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7466B354 for ; Fri, 28 Aug 2020 20:18:47 +0000 (UTC) From: "Thomas Deutschmann" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Deutschmann" Message-ID: <1598643333.4f9a09147887a6d108a8e55ab47a53d1016efee9.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_initramfs.sh X-VCS-Directories: / X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 4f9a09147887a6d108a8e55ab47a53d1016efee9 X-VCS-Branch: master Date: Fri, 28 Aug 2020 20:18:47 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: dfb5a660-7688-4570-938f-6f538431631f X-Archives-Hash: b26b6c461392295a1b25737d6b561697 commit: 4f9a09147887a6d108a8e55ab47a53d1016efee9 Author: Thomas Deutschmann gentoo org> AuthorDate: Fri Aug 28 19:35:33 2020 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Fri Aug 28 19:35:33 2020 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=4f9a0914 gen_initramfs.sh: append_base_layout(): Create /etc/{group,passwd,shadow} in this function These files should be present all the time, not just when built with --ssh option set. Signed-off-by: Thomas Deutschmann gentoo.org> gen_initramfs.sh | 75 +++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 58 insertions(+), 17 deletions(-) diff --git a/gen_initramfs.sh b/gen_initramfs.sh index fcfa827..ae71c38 100755 --- a/gen_initramfs.sh +++ b/gen_initramfs.sh @@ -302,6 +302,7 @@ append_base_layout() { usr/bin \ usr/lib \ usr/sbin \ + var/empty \ var/log \ var/run/lock \ ; do @@ -333,6 +334,63 @@ append_base_layout() { echo "proc /proc proc defaults 0 0" >> "${TDIR}"/etc/fstab \ || gen_die "Failed to add proc to '${TDIR}/etc/fstab'!" + print_info 2 "$(get_indent 2)>> Adding /etc/{group,passwd,shadow} ..." + cat >"${TDIR}"/etc/group <<-EOF + root:x:0:root + bin:x:1:root,bin,daemon + daemon:x:2:root,bin,daemon + sys:x:3:root,bin,adm + adm:x:4:root,adm,daemon + tty:x:5: + disk:x:6:root,adm + lp:x:7:lp + mem:x:8: + kmem:x:9: + wheel:x:10:root + floppy:x:11:root + news:x:13:news + uucp:x:14:uucp + console:x:17: + audio:x:18: + cdrom:x:19: + dialout:x:20: + tape:x:26:root + video:x:27:root + render:x:28: + rpc:x:32: + kvm:x:78: + usb:x:85: + input:x:97: + utmp:x:406: + nogroup:x:65533: + nobody:x:65534: + EOF + + chmod 0644 "${TDIR}"/etc/group \ + || gen_die "Failed to chmod of '${TDIR}/etc/group'!" + + cat >"${TDIR}"/etc/passwd <<-EOF + root:x:0:0:root:/root:/usr/bin/login-remote.sh + nobody:x:65534:65534:nobody:/var/empty:/bin/false + EOF + + chmod 0644 "${TDIR}"/etc/passwd \ + || gen_die "Failed to chmod of '${TDIR}/etc/passwd'!" + + echo "root:!:0:0:99999:7:::" > "${TDIR}"/etc/shadow \ + || gen_die "Failed to create '/etc/shadow'!" + + chmod 0640 "${TDIR}"/etc/shadow \ + || gen_die "Failed to chmod of '${TDIR}/etc/shadow'!" + + print_info 2 "$(get_indent 2)>> Adding /etc/nsswitch.conf ..." + cat >"${TDIR}"/etc/nsswitch.conf <<-EOF + # /etc/nsswitch.conf generated by genkernel + passwd: files + shadow: files + group: files + EOF + print_info 2 "$(get_indent 2)>> Adding /etc/ld.so.conf ..." cat >"${TDIR}"/etc/ld.so.conf <<-EOF # ld.so.conf generated by genkernel @@ -1548,18 +1606,10 @@ append_dropbear() { cp -aL /etc/localtime "${TDIR}"/etc/ \ || gen_die "Failed to copy '/etc/localtime'. Please set system's timezone!" - echo "root:x:0:0:root:/root:/usr/bin/login-remote.sh" > "${TDIR}"/etc/passwd \ - || gen_die "Failed to create '/etc/passwd'!" echo "/usr/bin/login-remote.sh" > "${TDIR}"/etc/shells \ || gen_die "Failed to create '/etc/shells'!" - echo "root:!:0:0:99999:7:::" > "${TDIR}"/etc/shadow \ - || gen_die "Failed to create '/etc/shadow'!" - - echo "root:x:0:root" > "${TDIR}"/etc/group \ - || gen_die "Failed to create '/etc/group'!" - chmod 0755 "${TDIR}"/usr/bin/login-remote.sh \ || gen_die "Failed to chmod of '${TDIR}/usr/bin/login-remote.sh'!" @@ -1572,15 +1622,6 @@ append_dropbear() { chmod 0755 "${TDIR}"/usr/sbin/unlock-zfs \ || gen_die "Failed to chmod of '${TDIR}/usr/sbin/unlock-zfs'!" - chmod 0640 "${TDIR}"/etc/shadow \ - || gen_die "Failed to chmod of '${TDIR}/etc/shadow'!" - - chmod 0644 "${TDIR}"/etc/passwd \ - || gen_die "Failed to chmod of '${TDIR}/etc/passwd'!" - - chmod 0644 "${TDIR}"/etc/group \ - || gen_die "Failed to chmod of '${TDIR}/etc/group'!" - cd "${TDIR}" || gen_die "Failed to chdir to '${TDIR}'!" log_future_cpio_content find . -print0 | "${CPIO_COMMAND}" ${CPIO_ARGS} --append -F "${CPIO_ARCHIVE}" \