From df100318909313694b45ee00983c014b2fd3bbeb Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 10 May 2022 18:07:47 +0200 Subject: mbuto: Add /usr/local/sbin to PATH, in pre-init script and on fakeroot call Otherwise, we'll source executables from /sbin or /usr/sbin first, which is of course not desirable. While at it, remove a mostly duplicated definition of FIXUP for the kselftests profile, so that we just need to fix this in the first FIXUP block. Signed-off-by: Stefano Brivio --- mbuto | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/mbuto b/mbuto index 20427ad..b4a7cc0 100755 --- a/mbuto +++ b/mbuto @@ -51,7 +51,7 @@ THREADS="$(nproc)" # Fix-up script to run before /init, can be omitted [ -z "${FIXUP}" ] && FIXUP='#!/bin/sh -export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin +export PATH=/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/sbin:/usr/sbin: mount -t proc proc /proc mount -t sysfs sys /sys @@ -285,26 +285,7 @@ profile_kselftests() { [ ! -z "${SUBOPT_collection}" ] && __run_args="-c ${SUBOPT_collection}" [ ! -z "${SUBOPT_test}" ] && __run_args="${__run_args} -t ${SUBOPT_test}" - FIXUP='#!/bin/sh - - export PATH=/bin:/usr/bin:/sbin:/usr/sbin - - mount -t proc proc /proc - mount -t sysfs sys /sys - - mount -t devtmpfs dev /dev - - mkdir /dev/pts - mount -t devpts pts /dev/pts - - mkdir -p /sys/kernel/debug - mount -t debugfs debug /sys/kernel/debug - - # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=968199 - ln -sf /proc/self/fd /dev/fd - ln -sf /dev/fd/0 /dev/stdin - ln -sf /dev/fd/1 /dev/stdout - ln -sf /dev/fd/2 /dev/stderr + FIXUP="${FIXUP}"' set +m :> /etc/fstab @@ -1206,7 +1187,8 @@ if [ "${LD_PRELOAD}" != "libfakeroot-sysv.so" ] && [ "$(id -u)" -ne 0 ]; then if ! FAKEROOT="$(command -v fakeroot)"; then __fakeroot_missing="y" else - PATH="${PATH}:/sbin:/usr/sbin" "${FAKEROOT}" "${0}" "${@}" + PATH="${PATH}:/usr/local/sbin:/sbin:/usr/sbin" \ + "${FAKEROOT}" "${0}" "${@}" exit ${?} fi fi -- cgit v1.2.3