Skip to content
Merged
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
15 changes: 10 additions & 5 deletions build/office-suite/scripts/install_sourceos_office_shell_smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ OPEN_BIN="$HOME/.local/bin/sourceos-office-open"
SOURCEOS_OFFICE_BIN="$HOME/.local/bin/sourceos-office"
CLOUD_BIN="$HOME/.local/bin/office_cloud_handoff.sh"
MIME_FILE="$XDG_CONFIG_HOME/mimeapps.list"
TEST_DOC="$TMPDIR/demo.txt"
echo "SourceOS office shell smoke" > "$TEST_DOC"

[[ -f "$DESKTOP_FILE" ]] || {
echo "office shell installer smoke failed: missing desktop entry" >&2
Expand All @@ -43,10 +45,13 @@ MIME_FILE="$XDG_CONFIG_HOME/mimeapps.list"
exit 1
}

OUT="$($SOURCEOS_OFFICE_BIN help)"
[[ "$OUT" == *"usage: sourceos-office"* ]] || {
echo "office shell installer smoke failed: sourceos-office help mismatch" >&2
exit 1
}
OUT="$(SOURCEOS_OFFICE_MODE=cloud "$SOURCEOS_OFFICE_BIN" open "$TEST_DOC")"
case "$OUT" in
http://*|https://*) ;;
*)
echo "office shell installer smoke failed: installed sourceos-office open path did not return URL" >&2
exit 1
;;
esac

echo "office shell installer smoke passed"
25 changes: 20 additions & 5 deletions build/office-suite/scripts/sourceos-office
Original file line number Diff line number Diff line change
@@ -1,22 +1,37 @@
#!/usr/bin/env bash
set -euo pipefail

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"
CMD="${1:-help}"
shift || true

resolve_helper() {
local sibling="$1"
local repo_path="$2"
if [[ -x "$SCRIPT_DIR/$sibling" ]]; then
printf '%s\n' "$SCRIPT_DIR/$sibling"
return 0
fi
if [[ -x "$ROOT/$repo_path" ]]; then
printf '%s\n' "$ROOT/$repo_path"
return 0
fi
return 1
}

case "$CMD" in
install)
"$ROOT/build/office-suite/scripts/install_sourceos_office_shell.sh"
"$(resolve_helper install_sourceos_office_shell.sh build/office-suite/scripts/install_sourceos_office_shell.sh)"
;;
verify)
"$ROOT/build/office-suite/scripts/office_shell_verify.sh"
"$(resolve_helper office_shell_verify.sh build/office-suite/scripts/office_shell_verify.sh)"
;;
open)
"$ROOT/build/office-suite/scripts/office_open.sh" "$@"
"$(resolve_helper office_open.sh build/office-suite/scripts/office_open.sh)" "$@"
;;
search)
"$ROOT/build/office-suite/scripts/office_search_open.sh" "$@"
"$(resolve_helper office_search_open.sh build/office-suite/scripts/office_search_open.sh)" "$@"
;;
help|*)
cat <<'EOF'
Expand Down