From 2f8ce018523f2b40365f43e5869b3587c022e033 Mon Sep 17 00:00:00 2001 From: Firefly Team Date: Sun, 23 Jun 2019 11:32:59 +0800 Subject: [PATCH] Docker: override stty size in container (#1420) With some docker CLI version, `stty size` in the container will return `0 0`, which causes `dialog` to fail. This commit fixes that by setting the actual terminal size. For more infor, see: https://github.com/docker/for-linux/issues/314 --- config-docker.conf | 2 ++ lib/main.sh | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/config-docker.conf b/config-docker.conf index 868c7dedb2..aab4f71030 100644 --- a/config-docker.conf +++ b/config-docker.conf @@ -77,6 +77,8 @@ DOCKER_FLAGS+=(-v=$SRC/:/root/armbian/) # mount 2 named volumes - for cacheable data and compiler cache DOCKER_FLAGS+=(-v=armbian-cache:/root/armbian/cache -v=armbian-ccache:/root/.ccache) +DOCKER_FLAGS+=(-e COLUMNS="`tput cols`" -e LINES="`tput lines`") + # pass other command line arguments like KERNEL_ONLY=yes, KERNEL_CONFIGURE=yes, etc. # pass "docker-guest" as an additional config name that will be sourced in the container if exists display_alert "Running the container" "" "info" diff --git a/lib/main.sh b/lib/main.sh index c629d641f1..e066ecfeab 100644 --- a/lib/main.sh +++ b/lib/main.sh @@ -26,6 +26,10 @@ umask 002 # destination DEST=$SRC/output +# override stty size +[[ -n $COLUMNS ]] && stty cols $COLUMNS +[[ -n $LINES ]] && stty rows $LINES + TTY_X=$(($(stty size | awk '{print $2}')-6)) # determine terminal width TTY_Y=$(($(stty size | awk '{print $1}')-6)) # determine terminal height