Merge pull request #45911 from samueldr/fix/nixos-help-browser

nixos/manual: nixos-help knows about colon-separated BROWSER
This commit is contained in:
Graham Christensen 2018-09-02 14:30:22 -04:00 committed by GitHub
commit 146f8bac7e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -44,7 +44,13 @@ let
helpScript = pkgs.writeScriptBin "nixos-help"
''
#! ${pkgs.runtimeShell} -e
browser="$BROWSER"
# Finds first executable browser in a colon-separated list.
# (see how xdg-open defines BROWSER)
browser="$(
IFS=: ; for b in $BROWSER; do
[ -n "$(type -P "$b" || true)" ] && echo "$b" && break
done
)"
if [ -z "$browser" ]; then
browser="$(type -P xdg-open || true)"
if [ -z "$browser" ]; then