You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
427 B
25 lines
427 B
5 years ago
|
#!/bin/sh
|
||
|
|
||
|
# echo $@
|
||
|
# set -x
|
||
|
|
||
|
chroot="$1"; shift
|
||
|
|
||
|
script=$(mktemp "${chroot}/tmp/chroot-${0##*/}.XXXXXXXXXX")
|
||
|
trap cleanup INT TERM EXIT
|
||
|
cleanup() {
|
||
|
[ $__cdist_debug ] || rm "$script"
|
||
|
}
|
||
|
|
||
|
echo "#!/bin/sh -l" > "$script"
|
||
|
echo "$@" >> "$script"
|
||
|
chmod +x "$script"
|
||
|
|
||
|
relative_script="${script#$chroot}"
|
||
|
|
||
|
# ensure PATH is setup
|
||
|
export PATH=$PATH:/bin:/usr/bin:/sbin:/usr/sbin
|
||
|
|
||
|
# run in chroot
|
||
|
chroot "$chroot" "$relative_script"
|