diff options
Diffstat (limited to 'src')
-rwxr-xr-x | src/chroot-tools/librechroot | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot index bebc46f..81163b0 100755 --- a/src/chroot-tools/librechroot +++ b/src/chroot-tools/librechroot @@ -178,8 +178,14 @@ arch_nspawn_flags=() sysd_nspawn_flags=() arch-nspawn() { local copydir=$1; shift + if [[ -t 1 ]]; then + cmd=("$@") + else + cmd=(bash --noprofile --norc -c "$(printf '%q ' "$@") |&cat") + fi + set +u # if an array is empty, it counts as unbound - "$_arch_nspawn" "${arch_nspawn_flags[@]}" "$copydir" "${sysd_nspawn_flags[@]}" -- "$@" + "$_arch_nspawn" "${arch_nspawn_flags[@]}" "$copydir" "${sysd_nspawn_flags[@]}" -- "${cmd[@]}" set -u } @@ -236,6 +242,10 @@ main() { umask 0022 + if ! [[ -t 0 ]]; then + warning "Input is not a TTY--signals will not be handled correctly." + fi + # Keep this lock as long as we are running # Note that '9' is the same FD number as in mkarchroot et al. lock 9 "$copydir.lock" \ |