From c6bff4f7fc3ffc0e1e9883a812e05b53995514d4 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Wed, 26 Jun 2013 19:48:07 +0200 Subject: build-chroot: support interpreter detection --- build-chroot | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'build-chroot') diff --git a/build-chroot b/build-chroot index cd608e6..dd0edee 100755 --- a/build-chroot +++ b/build-chroot @@ -1,6 +1,6 @@ #!/bin/bash VERSION=0.1 -find_libs=~/scripts/find-libs +find_libs=$(dirname "$(readlink -f "$0")")/find-libs usage() { cat < python2 + case "$interp" in + env|/usr/bin/env) + awk -F '[#! \t]+' '{ + for (i=3;i/dev/null)" || true if [ -n "$realsubject" ]; then subjects[${#subjects[@]}]="$realsubject" + for extra in $(resolve_interpreter "$realsubject"); do + if path="$(which "$extra" 2>/dev/null)"; then + subjects[${#subjects[@]}]="$path" + else + echo "Missing program: $extra" + ((errors++)) + fi + done else echo "Missing file: $subject" + ((errors++)) fi done -if ! [ $# = ${#subjects[@]} ]; then - echo "Some files could not be found" - echo "Expected $#, got ${#subjects[@]} valid args." +if [ $errors -ne 0 ]; then + echo "$errors files could not be found" if ! $CONT_ON_ERR; then echo "Aborting. To ignore this, pass the '--continue' option." exit 255 -- cgit v1.2.1