Skip to content
Closed
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
17 changes: 17 additions & 0 deletions build/office-suite/scripts/install_sourceos_office_shell_smoke.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@ mkdir -p "$HOME"

DESKTOP_FILE="$XDG_DATA_HOME/applications/sourceos-office.desktop"
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 @@ -27,6 +30,11 @@ MIME_FILE="$XDG_CONFIG_HOME/mimeapps.list"
exit 1
}

[[ -x "$SOURCEOS_OFFICE_BIN" ]] || {
echo "office shell installer smoke failed: missing sourceos-office command" >&2
exit 1
}

[[ -x "$CLOUD_BIN" ]] || {
echo "office shell installer smoke failed: missing cloud handoff helper" >&2
exit 1
Expand All @@ -37,4 +45,13 @@ MIME_FILE="$XDG_CONFIG_HOME/mimeapps.list"
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