xref: /trunk/test/odf-validate/fixtures/encrypted/run.sh (revision 0e16a31d78a652c56c5c0fc79c752f48b9048df9)
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# usage: run.sh <port-base>   -- writes runs/task12/gen-encrypted/<strict|ext>/{out,twin,plain} for the four
21# UseSHA1InODF12/UseBlowfishInODF12 combinations, using profiles t12_enc_<mode>[_variant] on ports base..base+7
22source ${0:A:h}/../../env.sh
23base=${1:?port base}
24G=$D/runs/task12/gen-encrypted
25port=$base
26for mode in strict ext; do
27  case $mode in ext) v=3;; strict) v=4;; esac
28  mkdir -p $G/$mode/out $G/$mode/twin $G/$mode/plain
29  for var in default aes sha1aes sha256bf; do
30    case $var in default) sha1=true; bf=true; p=t12_enc_$mode;; aes) sha1=false; bf=false; p=t12_enc_${mode}_aes;;
31      sha1aes) sha1=true; bf=false; p=t12_enc_${mode}_sha1aes;; sha256bf) sha1=false; bf=true; p=t12_enc_${mode}_sha256bf;; esac
32    /bin/rm -rf $D/runs/profile_$p
33    mkdir -p $D/runs/profile_$p/user
34    cat > $D/runs/profile_$p/user/registrymodifications.xcu <<XCU
35<?xml version="1.0" encoding="UTF-8"?>
36<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">
37<item oor:path="/org.openoffice.Office.Common/Save/ODF"><prop oor:name="DefaultVersion" oor:op="fuse"><value>$v</value></prop></item>
38<item oor:path="/org.openoffice.Office.Common/Save/ODF"><prop oor:name="UseSHA1InODF12" oor:op="fuse"><value>$sha1</value></prop></item>
39<item oor:path="/org.openoffice.Office.Common/Save/ODF"><prop oor:name="UseBlowfishInODF12" oor:op="fuse"><value>$bf</value></prop></item>
40</oor:items>
41XCU
42    $D/start.sh $p $port || exit 2
43    (cd $D && ./runpy.sh fixtures/encrypted/make.py $port $G/$mode/out $G/$mode/twin) || exit 3
44    pkill -f "profile_$p"
45    (( port++ ))
46  done
47done
48