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
4 changes: 3 additions & 1 deletion build/office-suite/scripts/install_sourceos_office_shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ BIN_DIR="$HOME/.local/bin"

mkdir -p "$BIN_DIR"
cp "$ROOT/build/office-suite/scripts/sourceos-office" "$BIN_DIR/sourceos-office"
chmod +x "$BIN_DIR/sourceos-office"
cp "$ROOT/build/office-suite/scripts/office_shell_verify.sh" "$BIN_DIR/office_shell_verify.sh"
chmod +x "$BIN_DIR/sourceos-office" "$BIN_DIR/office_shell_verify.sh"

if [[ -x "$ROOT/build/office-suite/scripts/verify_office_suite_profile.sh" ]]; then
"$ROOT/build/office-suite/scripts/verify_office_suite_profile.sh"
fi

echo "installed sourceos-office to $BIN_DIR/sourceos-office"
echo "installed office_shell_verify.sh to $BIN_DIR/office_shell_verify.sh"
echo "SourceOS office shell install completed"
12 changes: 12 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 @@ -15,6 +15,7 @@ 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"
VERIFY_BIN="$HOME/.local/bin/office_shell_verify.sh"
CLOUD_BIN="$HOME/.local/bin/office_cloud_handoff.sh"
MIME_FILE="$XDG_CONFIG_HOME/mimeapps.list"
TEST_DOC="$TMPDIR/demo.txt"
Expand All @@ -35,6 +36,11 @@ echo "SourceOS office shell smoke" > "$TEST_DOC"
exit 1
}

[[ -x "$VERIFY_BIN" ]] || {
echo "office shell installer smoke failed: missing office_shell_verify helper" >&2
exit 1
}

[[ -x "$CLOUD_BIN" ]] || {
echo "office shell installer smoke failed: missing cloud handoff helper" >&2
exit 1
Expand All @@ -54,4 +60,10 @@ case "$OUT" in
;;
esac

VERIFY_OUT="$($SOURCEOS_OFFICE_BIN verify)"
[[ "$VERIFY_OUT" == *"office shell verification passed"* ]] || {
echo "office shell installer smoke failed: installed verify path did not pass" >&2
exit 1
}

echo "office shell installer smoke passed"
61 changes: 60 additions & 1 deletion build/office-suite/scripts/office_shell_verify.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,66 @@
#!/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)"
APP_DIR="${XDG_DATA_HOME:-$HOME/.local/share}/applications"
CONFIG_DIR="${XDG_CONFIG_HOME:-$HOME/.config}"
DESKTOP_FILE="$APP_DIR/sourceos-office.desktop"
MIME_FILE="$CONFIG_DIR/mimeapps.list"

if [[ -x "$SCRIPT_DIR/sourceos-office-open" ]]; then
[[ -f "$DESKTOP_FILE" ]] || {
echo "office shell verification failed: missing desktop entry" >&2
exit 1
}

[[ -x "$SCRIPT_DIR/sourceos-office" ]] || {
echo "office shell verification failed: missing sourceos-office command" >&2
exit 1
}

[[ -x "$SCRIPT_DIR/sourceos-office-open" ]] || {
echo "office shell verification failed: missing sourceos-office-open helper" >&2
exit 1
}

[[ -x "$SCRIPT_DIR/office_cloud_handoff.sh" ]] || {
echo "office shell verification failed: missing cloud handoff helper" >&2
exit 1
}

[[ -x "$SCRIPT_DIR/office_search_handoff.sh" ]] || {
echo "office shell verification failed: missing search handoff helper" >&2
exit 1
}

[[ -x "$SCRIPT_DIR/office_search_open.sh" ]] || {
echo "office shell verification failed: missing search open helper" >&2
exit 1
}

[[ -f "$MIME_FILE" ]] || {
echo "office shell verification failed: missing MIME defaults" >&2
exit 1
}

TMPDIR="$(mktemp -d)"
trap 'rm -rf "$TMPDIR"' EXIT
TEST_DOC="$TMPDIR/verify.txt"
echo "SourceOS office verify" > "$TEST_DOC"

OUT="$(SOURCEOS_OFFICE_MODE=cloud "$SCRIPT_DIR/sourceos-office" open "$TEST_DOC")"
case "$OUT" in
http://*|https://*) ;;
*)
echo "office shell verification failed: installed open path did not return URL" >&2
exit 1
;;
esac

echo "office shell verification passed"
exit 0
fi

"$ROOT/build/office-suite/scripts/verify_office_desktop_entry.sh"

Expand Down