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
18 changes: 18 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 @@ -112,6 +112,24 @@ grep -q "SourceOS sovereign writer template placeholder" "$NEW_DOC" || {
exit 1
}

DEFAULT_NEW_OUT="$($SOURCEOS_OFFICE_BIN new writer)"
case "$DEFAULT_NEW_OUT" in
"$HOME"/Documents/SourceOS/agent-output/*.fodt) ;;
*)
echo "office shell installer smoke failed: default new path did not use SourceOS agent-output" >&2
exit 1
;;
esac
[[ -f "$DEFAULT_NEW_OUT" ]] || {
echo "office shell installer smoke failed: default new path did not create file" >&2
exit 1
}

grep -q "SourceOS sovereign writer template placeholder" "$DEFAULT_NEW_OUT" || {
echo "office shell installer smoke failed: default writer file does not contain template payload" >&2
exit 1
}

"$SOURCEOS_OFFICE_BIN" install >/dev/null

echo "office shell installer smoke passed"
13 changes: 10 additions & 3 deletions build/office-suite/scripts/office_new.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env bash
set -euo pipefail

if [[ $# -lt 2 ]]; then
echo "usage: $0 <writer> <output-file>" >&2
if [[ $# -lt 1 ]]; then
echo "usage: $0 <writer> [output-file]" >&2
exit 1
fi

KIND="$1"
OUTPUT="$2"
OUTPUT="${2:-}"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ROOT="$(cd "$SCRIPT_DIR/../../.." && pwd)"

Expand All @@ -18,13 +18,20 @@ case "$KIND" in
else
TEMPLATE="$ROOT/build/office-suite/templates/sovereign/sourceos-default-writer.fodt"
fi
SUFFIX="fodt"
;;
*)
echo "unsupported office kind: $KIND" >&2
exit 2
;;
esac

if [[ -z "$OUTPUT" ]]; then
OUTPUT_DIR="$HOME/Documents/SourceOS/agent-output"
mkdir -p "$OUTPUT_DIR"
OUTPUT="$OUTPUT_DIR/sourceos-${KIND}-$(date +%Y%m%d-%H%M%S).${SUFFIX}"
fi

mkdir -p "$(dirname "$OUTPUT")"
cp "$TEMPLATE" "$OUTPUT"
echo "$OUTPUT"