nixos/manual: nixos-help knows about colon-separated BROWSER
This is the semantics as understood by `xdg-open`. Using these semantics on a non-colon-separated variable works because it acts as if it was a one element long list. This fixes an issue where it would try to exec `google-chrome-beta:google-chrome:chromium:firefox` on a system configured with these semantics in mind.
This commit is contained in:
parent
4477cf04b6
commit
4ff5f304b9
@ -44,7 +44,13 @@ let
|
|||||||
helpScript = pkgs.writeScriptBin "nixos-help"
|
helpScript = pkgs.writeScriptBin "nixos-help"
|
||||||
''
|
''
|
||||||
#! ${pkgs.runtimeShell} -e
|
#! ${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
|
if [ -z "$browser" ]; then
|
||||||
browser="$(type -P xdg-open || true)"
|
browser="$(type -P xdg-open || true)"
|
||||||
if [ -z "$browser" ]; then
|
if [ -z "$browser" ]; then
|
||||||
|
Loading…
x
Reference in New Issue
Block a user