From e3be62b96a20f39ca9e271c5e7f6fa901c4142e7 Mon Sep 17 00:00:00 2001 From: Valentin Niess Date: Thu, 13 Dec 2018 14:45:48 +0000 Subject: [PATCH] Use `ip addr` when `ifconfig` is missing --- acroread | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/acroread b/acroread index abf416d..c723b1b 100755 --- a/acroread +++ b/acroread @@ -2,6 +2,7 @@ main() { local document="${1}" local file + local ipaddr if [[ -z "${document}" ]]; then document="${HOME}/Documents" @@ -13,13 +14,19 @@ main() { fi fi + if [[ $(type -p "ifconfig") ]]; then + ipaddr="ifconfig" + else + ipaddr="ip addr show dev" + fi + docker run --rm -v "${document}:/home/acroread/Documents:rw" \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -v /var/run/cups:/var/run/cups:ro \ -e uid="$(id -u)" \ -e gid="$(id -g)" \ -e DISPLAY="unix${DISPLAY}" \ - -e CUPS_SERVER="$(ifconfig docker0 | awk '/^[ ]+inet / {print $2}')" \ + -e CUPS_SERVER="$(${ipaddr} docker0 | awk '/^[ ]+inet / {print $2}')" \ -e FILE="${file}" \ --name acroread \ mgor/acroread >& /dev/null