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
6 changes: 5 additions & 1 deletion build/office-suite/scripts/install_sourceos_office_shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ mkdir -p "$BIN_DIR"
cp "$ROOT/build/office-suite/scripts/sourceos-office" "$BIN_DIR/sourceos-office"
cp "$ROOT/build/office-suite/scripts/install_sourceos_office_shell.sh" "$BIN_DIR/install_sourceos_office_shell.sh"
cp "$ROOT/build/office-suite/scripts/office_shell_verify.sh" "$BIN_DIR/office_shell_verify.sh"
chmod +x "$BIN_DIR/sourceos-office" "$BIN_DIR/install_sourceos_office_shell.sh" "$BIN_DIR/office_shell_verify.sh"
cp "$ROOT/build/office-suite/scripts/office_new.sh" "$BIN_DIR/office_new.sh"
cp "$ROOT/build/office-suite/templates/sovereign/sourceos-default-writer.fodt" "$BIN_DIR/sourceos-default-writer.fodt"
chmod +x "$BIN_DIR/sourceos-office" "$BIN_DIR/install_sourceos_office_shell.sh" "$BIN_DIR/office_shell_verify.sh" "$BIN_DIR/office_new.sh"

if [[ -x "$ROOT/build/office-suite/scripts/verify_office_suite_profile.sh" ]]; then
"$ROOT/build/office-suite/scripts/verify_office_suite_profile.sh"
Expand All @@ -20,4 +22,6 @@ fi
echo "installed sourceos-office to $BIN_DIR/sourceos-office"
echo "installed install_sourceos_office_shell.sh to $BIN_DIR/install_sourceos_office_shell.sh"
echo "installed office_shell_verify.sh to $BIN_DIR/office_shell_verify.sh"
echo "installed office_new.sh to $BIN_DIR/office_new.sh"
echo "installed sourceos-default-writer.fodt to $BIN_DIR/sourceos-default-writer.fodt"
echo "SourceOS office shell install completed"
22 changes: 22 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 @@ -17,9 +17,11 @@ OPEN_BIN="$HOME/.local/bin/sourceos-office-open"
SOURCEOS_OFFICE_BIN="$HOME/.local/bin/sourceos-office"
INSTALL_BIN="$HOME/.local/bin/install_sourceos_office_shell.sh"
VERIFY_BIN="$HOME/.local/bin/office_shell_verify.sh"
NEW_BIN="$HOME/.local/bin/office_new.sh"
CLOUD_BIN="$HOME/.local/bin/office_cloud_handoff.sh"
MIME_FILE="$XDG_CONFIG_HOME/mimeapps.list"
TEST_DOC="$TMPDIR/demo.txt"
NEW_DOC="$TMPDIR/new-writer.fodt"
echo "SourceOS office shell smoke" > "$TEST_DOC"

[[ -f "$DESKTOP_FILE" ]] || {
Expand Down Expand Up @@ -47,6 +49,11 @@ echo "SourceOS office shell smoke" > "$TEST_DOC"
exit 1
}

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

[[ -x "$CLOUD_BIN" ]] || {
echo "office shell installer smoke failed: missing cloud handoff helper" >&2
exit 1
Expand Down Expand Up @@ -90,6 +97,21 @@ case "$SEARCH_OUT" in
;;
esac

NEW_OUT="$($SOURCEOS_OFFICE_BIN new writer "$NEW_DOC")"
[[ "$NEW_OUT" == "$NEW_DOC" ]] || {
echo "office shell installer smoke failed: installed sourceos-office new path did not return created file" >&2
exit 1
}
[[ -f "$NEW_DOC" ]] || {
echo "office shell installer smoke failed: installed sourceos-office new path did not create file" >&2
exit 1
}

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

"$SOURCEOS_OFFICE_BIN" install >/dev/null

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

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

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

case "$KIND" in
writer)
if [[ -f "$SCRIPT_DIR/sourceos-default-writer.fodt" ]]; then
TEMPLATE="$SCRIPT_DIR/sourceos-default-writer.fodt"
else
TEMPLATE="$ROOT/build/office-suite/templates/sovereign/sourceos-default-writer.fodt"
fi
;;
*)
echo "unsupported office kind: $KIND" >&2
exit 2
;;
esac

mkdir -p "$(dirname "$OUTPUT")"
cp "$TEMPLATE" "$OUTPUT"
echo "$OUTPUT"
5 changes: 4 additions & 1 deletion build/office-suite/scripts/sourceos-office
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ case "$CMD" in
search)
"$(resolve_helper office_search_open.sh build/office-suite/scripts/office_search_open.sh)" "$@"
;;
new)
"$(resolve_helper office_new.sh build/office-suite/scripts/office_new.sh)" "$@"
;;
help|*)
cat <<'EOF'
usage: sourceos-office <install|verify|open|search> [args]
usage: sourceos-office <install|verify|open|search|new> [args]
EOF
;;
esac