1#!/bin/zsh 2#************************************************************** 3# 4# Licensed to the Apache Software Foundation (ASF) under one 5# or more contributor license agreements. See the NOTICE file 6# distributed with this work for additional information 7# regarding copyright ownership. The ASF licenses this file 8# to you under the Apache License, Version 2.0 (the 9# "License"); you may not use this file except in compliance 10# with the License. You may obtain a copy of the License at 11# 12# http://www.apache.org/licenses/LICENSE-2.0 13# 14# Unless required by applicable law or agreed to in writing, 15# software distributed under the License is distributed on an 16# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17# KIND, either express or implied. See the License for the 18# specific language governing permissions and limitations 19# under the License. 20# 21#************************************************************** 22# usage: start-ui.sh <strict|ext> <port> -- like start.sh but -invisible instead of -headless, because -headless 23# cancels every modal dialog and the signing dialog is the only way to sign. Uses the throw-away NSS database 24# (MOZILLA_CERTIFICATE_FOLDER, which also stops AOO from looking at any Mozilla profile) and creates the profile. 25source ${0:A:h}/../../env.sh 26mode=$1; port=$2 27case $mode in ext) v=3;; strict) v=4;; *) echo "start-ui.sh: mode must be ext or strict" >&2; exit 2;; esac 28db=$D/runs/task12/gen-signed/nssdb 29[[ -e $db/cert9.db ]] || { echo "start-ui.sh: run setup-cert.sh first" >&2; exit 2; } 30prof=$D/runs/profile_t12_sign_$mode 31if [[ ! -e $prof/user/registrymodifications.xcu ]]; then 32 mkdir -p $prof/user 33 cat > $prof/user/registrymodifications.xcu <<XCU 34<?xml version="1.0" encoding="UTF-8"?> 35<oor:items xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 36<item oor:path="/org.openoffice.Office.Common/Save/ODF"><prop oor:name="DefaultVersion" oor:op="fuse"><value>$v</value></prop></item> 37</oor:items> 38XCU 39fi 40export MOZILLA_CERTIFICATE_FOLDER=sql:$db 41nohup $APP/MacOS/soffice -invisible -nofirststartwizard -norestore -nologo -nodefault \ 42 -env:UserInstallation=file://$prof "-accept=socket,host=localhost,port=$port;urp;" \ 43 >>$D/runs/soffice_t12_sign_$mode.log 2>&1 & 44for i in {1..180}; do lsof -nP -iTCP:$port -sTCP:LISTEN >/dev/null 2>&1 && exit 0; sleep 1; done 45echo "start-ui.sh: office on port $port did not come up" >&2; exit 1 46