From e70126eabef809fb0819a3a9a19dfadfacd312d4 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Sat, 3 Sep 2022 04:09:14 -0500 Subject: [PATCH] Remove dochroot and mkchroot (they require root access, which mkroot does not). --- scripts/runtest.sh | 60 ---------------------------------------------- 1 file changed, 60 deletions(-) diff --git a/scripts/runtest.sh b/scripts/runtest.sh index 8b7df985..9390bd59 100644 --- a/scripts/runtest.sh +++ b/scripts/runtest.sh @@ -266,63 +266,3 @@ txpect() ! verbose_has quiet && echo "$VERBOSITY" >&2 fi } - -# Recursively grab an executable and all the libraries needed to run it. -# Source paths beginning with / will be copied into destpath, otherwise -# the file is assumed to already be there and only its library dependencies -# are copied. - -mkchroot() -{ - [ $# -lt 2 ] && return - - echo -n . - - dest=$1 - shift - for i in "$@" - do - [ "${i:0:1}" == "/" ] || i=$(which $i) - [ -f "$dest/$i" ] && continue - if [ -e "$i" ] - then - d=`echo "$i" | grep -o '.*/'` && - mkdir -p "$dest/$d" && - cat "$i" > "$dest/$i" && - chmod +x "$dest/$i" - else - echo "Not found: $i" - fi - mkchroot "$dest" $(ldd "$i" | egrep -o '/.* ') - done -} - -# Set up a chroot environment and run commands within it. -# Needed commands listed on command line -# Script fed to stdin. - -dochroot() -{ - mkdir tmpdir4chroot - mount -t ramfs tmpdir4chroot tmpdir4chroot - mkdir -p tmpdir4chroot/{etc,sys,proc,tmp,dev} - cp -L testing.sh tmpdir4chroot - - # Copy utilities from command line arguments - - echo -n "Setup chroot" - mkchroot tmpdir4chroot $* - echo - - mknod tmpdir4chroot/dev/tty c 5 0 - mknod tmpdir4chroot/dev/null c 1 3 - mknod tmpdir4chroot/dev/zero c 1 5 - - # Copy script from stdin - - cat > tmpdir4chroot/test.sh - chmod +x tmpdir4chroot/test.sh - chroot tmpdir4chroot /test.sh - umount -l tmpdir4chroot - rmdir tmpdir4chroot -} -- 2.39.2