Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1024,10 +1024,16 @@ main() {
start_note=" started: $SERVICE_NAME.service"
if [ "$INSTALL_MODE" = "user" ]; then
start_note=" started: brig-containerd.service (systemd --user)"
# The line is for a startup file, so it says $HOME as written there. That
# also keeps a home path with a quote or a $ in it from breaking the line.
line_dir="$LAUNCH_DIR"
case "$LAUNCH_DIR" in
"$HOME"/*) line_dir="\$HOME${LAUNCH_DIR#"$HOME"}" ;;
esac
case ":$PATH:" in
*":$LAUNCH_DIR:"*) ;;
*":$LAUNCH_DIR:"* | *":$LAUNCH_DIR/:"*) ;;
*) grp_note=" path: $LAUNCH_DIR is not on your PATH. Add it to run brig by name:
export PATH=\"$LAUNCH_DIR:\$PATH\"
export PATH=\"$line_dir:\$PATH\"
Put that line in your shell's startup file to keep it.
Do not add $BIN_DIR: the brig there runs without the launcher's environment.
" ;;
Expand Down
19 changes: 17 additions & 2 deletions tests/install-summary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,23 @@ ok "the summary names the bundle and its version"

# The line to type, since the only other full paths on screen are under the
# tree's bin directory, and a brig run from there has no launcher environment.
grep -qF "export PATH=\"$T/home/.local/bin:\$PATH\"" "$T/out.log" \
|| { cat "$T/out.log" >&2; fail "the summary does not give the PATH line"; }
# shellcheck disable=SC2016
grep -qF 'export PATH="$HOME/.local/bin:$PATH"' "$T/out.log" \
|| { cat "$T/out.log" >&2; fail "the summary does not give the PATH line as a startup file has it"; }
grep -qF "Do not add $T/home/.local/share/brig/data/bin:" "$T/out.log" \
|| { cat "$T/out.log" >&2; fail "the summary does not warn off the tree's bin directory"; }
ok "the summary gives the PATH line"

# A PATH entry written with a trailing slash is the same directory.
if ! env -u XDG_CONFIG_HOME -u XDG_DATA_HOME \
HOME="$T/home" XDG_RUNTIME_DIR="$T/run" PATH="$T/stub:$T/home/.local/bin/:$PATH" \
INSTALL_BRIG_BUNDLE="$T/bundle.tar.gz" \
sh "$here/install.sh" > "$T/out2.log" 2>&1; then
cat "$T/out2.log" >&2
fail "the second install failed"
fi
if grep -q "is not on your PATH" "$T/out2.log"; then
cat "$T/out2.log" >&2
fail "a PATH with the launcher directory and a trailing slash was told to add it"
fi
ok "a trailing slash on the PATH entry counts"