Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

aboutsummaryrefslogtreecommitdiffstats
blob: 7f1d6a5dd90a2814de3e635e3600abedf2433447 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
#!/bin/bash

f=$1
if [[ $f == "" ]]; then
    echo "No input file specified!"
    exit 1
fi
if [[ ! -f $f ]]; then
    echo "Input file $f not found!"
    exit 2
fi

shift
script=$1

if [[ $script == "" ]]; then
    echo "No script specified!"
    exit 3
fi

if [[ ! -f $script ]]; then
    echo "Script $script not found!"
    exit 4
fi

script=`readlink -f $script`

shift
args=$*

set -o nounset
set -o errexit

###########################################################################

file=`readlink -f $f`
echo "Post-processing $file"

tmp=$file-tmp
echo "Product dir: $tmp"

rm -rf $tmp
mkdir $tmp
cd $tmp

if [[ $file == *.tar.gz ]]; then

  tar -xzf $file
  bash $script $file $args

  if [[ $file == *mac64* ]]; then
    echo "  Signing Eclipse Installer.app"
    rm -rf "Eclipse Installer.app/Contents/_CodeSignature"
    chmod -R a-st "Eclipse Installer.app"
    zip -r -q unsigned.zip "Eclipse Installer.app"
    rm -rf "Eclipse Installer.app"
    curl -O https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/releng/org.eclipse.oomph.releng/hudson/installer.entitlements
    curl -o signed.zip -F file=@unsigned.zip -F entitlements=@installer.entitlements http://172.30.206.146:8282/macosx-signing-service/1.0.1-SNAPSHOT
    unzip -qq signed.zip
    rm -f unsigned.zip signed.zip
    chmod -R a-st "Eclipse Installer.app"
    chmod a+x "Eclipse Installer.app/Contents/MacOS/eclipse-inst"
    tar -czf $file-new "Eclipse Installer.app"
  else
    tar -czf $file-new *
  fi

  mv $file-new $file

elif [[ $file == *.exe ]]; then

  concatdir=`mktemp -d`
  echo "Concat dir: $concatdir"

  extractorlib=/home/data/httpd/download.eclipse.org/oomph/products/latest/repository/plugins/org.eclipse.oomph.extractor.lib_*.jar
  java -cp $extractorlib org.eclipse.oomph.extractor.lib.BINExtractor \
    $file \
    $concatdir/product.zip \
    -export \
    $concatdir/marker.txt \
    $concatdir/extractor.exe \
    $concatdir/libdata.jar \
    $concatdir/descriptor.txt

  unzip -qq $concatdir/product.zip
  bash $script $file $args
  zip -r -9 -qq --symlinks $file.zip *

  # Don't use the already signed extractor.exe but rather the one directly from git.
  # Otherwise signing will fail.
  curl -O https://git.eclipse.org/c/oomph/org.eclipse.oomph.git/plain/plugins/org.eclipse.oomph.extractor/extractor-64.exe

  cat extractor-64.exe \
    $concatdir/marker.txt \
    $concatdir/libdata.jar \
    $concatdir/marker.txt \
    $concatdir/descriptor.txt \
    $concatdir/marker.txt \
    $file.zip \
    $concatdir/marker.txt > $file-unsigned

  echo ""
  curl -o $file-new -F filedata=@$file-unsigned https://cbi.eclipse.org/authenticode/sign 

  actualSize=$(wc -c "$file-new" | cut -f 1 -d ' ')
  if [ $actualSize -lt 40000000 ]; then
    echo "$file-new is just $actualSize bytes large!"
    echo ""
    cat $file-new
    echo ""
    exit 5
  fi

  mv $file-new $file
  rm -rf $concatdir
  rm -rf $file.zip
  rm -rf $file-unsigned

elif [[ $file == *.zip ]]; then

  unzip -qq $file
  bash $script $file $args
  zip -r -9 -qq --symlinks $file-new *
  mv $file-new $file

fi

rm -rf $tmp
cd ..
echo ""

Back to the top