diff --git a/build/office-suite/scripts/install_sourceos_office_shell_smoke.sh b/build/office-suite/scripts/install_sourceos_office_shell_smoke.sh index 2521263..73eed85 100644 --- a/build/office-suite/scripts/install_sourceos_office_shell_smoke.sh +++ b/build/office-suite/scripts/install_sourceos_office_shell_smoke.sh @@ -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" diff --git a/build/office-suite/scripts/office_new.sh b/build/office-suite/scripts/office_new.sh index fa534cd..10515b3 100644 --- a/build/office-suite/scripts/office_new.sh +++ b/build/office-suite/scripts/office_new.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash set -euo pipefail -if [[ $# -lt 2 ]]; then - echo "usage: $0 " >&2 +if [[ $# -lt 1 ]]; then + echo "usage: $0 [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)" @@ -18,6 +18,7 @@ case "$KIND" in else TEMPLATE="$ROOT/build/office-suite/templates/sovereign/sourceos-default-writer.fodt" fi + SUFFIX="fodt" ;; *) echo "unsupported office kind: $KIND" >&2 @@ -25,6 +26,12 @@ case "$KIND" in ;; 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"