summaryrefslogtreecommitdiff
path: root/src/chroot-tools/librechroot
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2018-08-15 18:23:13 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2018-08-15 18:23:13 -0400
commitc078c5ee26a7d2ce730bd8f7560a5e5e33ddeaad (patch)
tree5b216011575e4027da54c06bc73eb3689758fa21 /src/chroot-tools/librechroot
parent462a40c24fdc49f454419d438088a6bc2ba0fdd1 (diff)
librechroot,libremakepkg: Don't have stdin of nspawn be a TTY if we don't expect input
If stdin is a TTY, systemd-nspawn will create a proxy PTY, and pump the data from real stdin through the proxy PTY. Because the PTY acts as a buffer, that means that it eats stdin, EVEN IF THE PROGRAM DOESN'T ACTUALLY READ IT. This is surprising to the user. We can't know if the command to `librechroot run` is going to read from stdin, but for most uses of librechroot we do know. So, set stdin to /dev/null for those cases.
Diffstat (limited to 'src/chroot-tools/librechroot')
-rwxr-xr-xsrc/chroot-tools/librechroot10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 8167793..8092f8d 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -426,7 +426,7 @@ main() {
if [[ ! -d $rootdir ]]; then
msg "Creating 'root' copy for chroot [%s]" "$CHROOT"
- mkarchroot "$rootdir" base-devel
+ mkarchroot "$rootdir" base-devel </dev/null
make_empty_repo "$rootdir"
fi
@@ -453,7 +453,7 @@ main() {
# - overwrite '/etc/pacman.d/mirrorlist'"
# - set 'CacheDir' in \`/etc/pacman.conf'"
# - apply -C or -M flags
- arch-nspawn "$copydir" true
+ arch-nspawn "$copydir" true </dev/null
if [[ -n ${tmppacmanconf:-} ]]; then
rm -f -- "$tmppacmanconf"
fi
@@ -474,14 +474,14 @@ main() {
# Dealing with packages
install-file)
- install_packages "$copydir" "$@"
+ install_packages "$copydir" "$@" </dev/null
chroot_add_to_local_repo "$copydir" "$@"
;;
install-name)
arch-nspawn "$copydir" pacman -Sy -- "$@"
;;
update)
- arch-nspawn "$copydir" pacman -Syu --noconfirm
+ arch-nspawn "$copydir" pacman -Syu --noconfirm </dev/null
;;
clean-pkgs)
trap "rm -f -- ${copydir@Q}/{bin/chcleanup,chrootexec}" EXIT
@@ -493,7 +493,7 @@ main() {
'/bin/chcleanup' \
> "$copydir/chrootexec"
chmod 755 "$copydir/chrootexec"
- arch-nspawn "$copydir" /chrootexec
+ arch-nspawn "$copydir" /chrootexec </dev/null
;;
# Other