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 49BE3138359 for ; Thu, 23 Jul 2020 23:57:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AEF38E0867; Thu, 23 Jul 2020 23:57:39 +0000 (UTC) Received: from smtp.gentoo.org (woodpecker.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 899A8E0867 for ; Thu, 23 Jul 2020 23:57:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 654E734F217 for ; Thu, 23 Jul 2020 23:57:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id C78B22EF for ; Thu, 23 Jul 2020 23:57:34 +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: <1595545007.81b8f5d615cec53aaf93e6bc11540d45a92d038d.whissi@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: defaults/ X-VCS-Repository: proj/genkernel X-VCS-Files: defaults/initrd.scripts defaults/linuxrc defaults/unlock-luks.sh X-VCS-Directories: defaults/ X-VCS-Committer: whissi X-VCS-Committer-Name: Thomas Deutschmann X-VCS-Revision: 81b8f5d615cec53aaf93e6bc11540d45a92d038d X-VCS-Branch: master Date: Thu, 23 Jul 2020 23:57:34 +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: d0c4a3dd-784c-4700-8169-7c499cd25368 X-Archives-Hash: 2abfb0c025b36870537f0e01bafa298a commit: 81b8f5d615cec53aaf93e6bc11540d45a92d038d Author: Thomas Deutschmann gentoo org> AuthorDate: Thu Jul 23 20:56:28 2020 +0000 Commit: Thomas Deutschmann gentoo org> CommitDate: Thu Jul 23 22:56:47 2020 +0000 URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=81b8f5d6 defaults/linuxrc: Make use of PATH Don't use absolute paths. Use 'hash' to test if command is available. Signed-off-by: Thomas Deutschmann gentoo.org> defaults/initrd.scripts | 28 ++++++++++++++++------------ defaults/linuxrc | 16 ++++++++-------- defaults/unlock-luks.sh | 2 +- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts index 426a64e..d95da4d 100644 --- a/defaults/initrd.scripts +++ b/defaults/initrd.scripts @@ -718,7 +718,7 @@ setup_aufs() { if ! hash e2fsck >/dev/null 2>&1 then - bad_msg "/sbin/e2fsck not found! aborting filesystem check" + bad_msg "e2fsck not found! aborting filesystem check" bad_msg "Moving ${aufs_union_file#*/} to ${aufs_union_file#*/}.bad" run mv "${aufs_dev_mnt}${aufs_union_file}" "${aufs_dev_mnt}${aufs_union_file}.bad" @@ -1675,16 +1675,20 @@ start_volumes() { if [ "${USE_BTRFS}" = '1' ] then - if [ -x '/sbin/btrfs' ] + if ! hash btrfs >/dev/null 2>&1 then + bad_msg "dobtrfs invoked but 'btrfs' not found; Skipping btrfs device scanning ..." + else good_msg "Scanning for BTRFS devices ..." - local btrfs_cmd="run /sbin/btrfs device scan 2>&1" + local btrfs_cmd="run btrfs device scan 2>&1" is_log_enabled && btrfs_cmd="${btrfs_cmd} | tee -a '${GK_INIT_LOG}'" eval "${btrfs_cmd}" - else - bad_msg "dobtrfs invoked but /sbin/btrfs not found; Skipping btrfs device scanning ..." + if [ $? -ne 0 ] + then + bad_msg "Scanning for BTRFS devices failed!" + fi fi fi @@ -1808,7 +1812,7 @@ start_iscsi() { # It is either the root or a swap, other devices are supported in the scripts provided with sys-fs/cryptsetup # $1 - root/swap openLUKS() { - if [ ! -x /sbin/cryptsetup ] + if ! hash cryptsetup >/dev/null 2>&1 then bad_msg "cryptsetup program is missing. Was initramfs built without --luks parameter?" exit 1 @@ -1945,7 +1949,7 @@ openLUKS() { if [ "$(echo ${LUKS_KEY} | grep -o '.gpg$')" = ".gpg" ] then - if [ ! -x '/usr/bin/gpg' ] + if ! hash gpg >/dev/null 2>&1 then bad_msg "GPG-encrypted key file provided but gpg program is missing. Was initramfs built without --gpg parameter?" bad_msg "Falling back to passphrase usage!" @@ -1953,7 +1957,7 @@ openLUKS() { [ -e /dev/tty ] && run mv /dev/tty /dev/tty.org run mknod /dev/tty c 5 1 cryptsetup_options="${cryptsetup_options} -d -" - gpg_cmd="/usr/bin/gpg --logger-file /dev/null --quiet --decrypt ${mntkey}${LUKS_KEY} |" + gpg_cmd="gpg --logger-file /dev/null --quiet --decrypt ${mntkey}${LUKS_KEY} |" fi else cryptsetup_options="${cryptsetup_options} -d ${mntkey}${LUKS_KEY}" @@ -2363,7 +2367,7 @@ start_sshd() { return fi - if [ ! -x "/usr/sbin/dropbear" ] + if ! hash dropbear >/dev/null 2>&1 then bad_msg "/usr/sbin/dropbear not found! Was initramfs built without --ssh parameter?" return @@ -2382,7 +2386,7 @@ start_sshd() { run touch /var/log/lastlog good_msg "Starting dropbear sshd ..." ${QUIET} - run /usr/sbin/dropbear -p ${GK_SSHD_PORT} -R -P "${GK_SSHD_PIDFILE}" 2>/var/log/dropbear.log + run dropbear -p ${GK_SSHD_PORT} -R -P "${GK_SSHD_PIDFILE}" 2>/var/log/dropbear.log if [ $? -eq 0 ] then if [ "${GK_PROMPT_TIMEOUT}" = '0' ] @@ -2534,9 +2538,9 @@ cdupdate() { setup_btrfsctl() { # start BTRFS volume detection, if available - if [ -x /sbin/btrfsctl ] + if hash btrfsctl >/dev/null 2>&1 then - local btrfs_cmd="run /sbin/btrfsctl -a 2>&1" + local btrfs_cmd="run btrfsctl -a 2>&1" is_log_enabled && btrfs_cmd="${btrfs_cmd} | tee -a '${GK_INIT_LOG}'" eval "${btrfs_cmd}" diff --git a/defaults/linuxrc b/defaults/linuxrc index f1357f6..7e3b388 100644 --- a/defaults/linuxrc +++ b/defaults/linuxrc @@ -40,11 +40,11 @@ echo 1 > /proc/sys/kernel/printk if [ ! -s /etc/ld.so.cache ] then # Looks like we were unable to run ldconfig during initramfs generation - [ -x /sbin/ldconfig ] && run /sbin/ldconfig + hash ldconfig >/dev/null 2>&1 && run ldconfig fi # Set up symlinks -run /bin/busybox --install -s +run busybox --install -s gk_ver="$(cat /etc/build_id)" gk_build_date="$(cat /etc/build_date)" @@ -460,7 +460,7 @@ fi if [ "${GK_BOOTFONT_DISABLED}" = '0' -a -e /lib/console/font ] then - [ -x /usr/sbin/setfont ] && run /usr/sbin/setfont /lib/console/font -C ${CONSOLE} 2>&1 + hash setfont >/dev/null 2>&1 && run setfont /lib/console/font -C ${CONSOLE} 2>&1 fi quiet_kmsg @@ -578,7 +578,7 @@ run mdev -s || bad_msg "mdev -s failed" cd / # Start iSCSI -if [ -e /bin/iscsistart ] +if hash iscsistart >/dev/null 2>&1 then start_iscsi fi @@ -1148,7 +1148,7 @@ FSTAB do tarname=$(basename ${targz}) good_msg "Adding additional package ${tarname}" - (cd ${NEW_ROOT} ; /bin/tar -xf ${targz}) + (cd ${NEW_ROOT} ; tar -xf ${targz}) done fi fi @@ -1359,15 +1359,15 @@ init=${REAL_INIT:-/sbin/init} if ! mountpoint "${CHROOT}" 1>/dev/null 2>&1 then bad_msg "${CHROOT} was not a mountpoint" -elif chroot "${CHROOT}" /usr/bin/test ! -x /${init#/} +elif chroot "${CHROOT}" test ! -x /${init#/} then bad_msg "init=${init} does not exist in the rootfs!" elif [ $$ != 1 ] then bad_msg "PID was not 1! switch_root would fail" else - good_msg "Switching to real root: /sbin/switch_root -c /dev/console ${CHROOT} ${init} ${init_opts}" - exec /sbin/switch_root -c "/dev/console" "${CHROOT}" "${init}" ${init_opts} + good_msg "Switching to real root: switch_root -c /dev/console ${CHROOT} ${init} ${init_opts}" + exec switch_root -c "/dev/console" "${CHROOT}" "${init}" ${init_opts} fi # If we get here, something bad has happened diff --git a/defaults/unlock-luks.sh b/defaults/unlock-luks.sh index 0f54504..6ca60e0 100644 --- a/defaults/unlock-luks.sh +++ b/defaults/unlock-luks.sh @@ -37,7 +37,7 @@ then fi main() { - if [ ! -x /sbin/cryptsetup ] + if ! hash cryptsetup >/dev/null 2>&1 then bad_msg "cryptsetup program is missing. Was initramfs built without --luks parameter?" exit 1