~ubuntu-branches/ubuntu/utopic/vlc/utopic

« back to all changes in this revision

Viewing changes to extras/package/macosx/codesign.sh

  • Committer: Package Import Robot
  • Author(s): Benjamin Drung
  • Date: 2012-07-21 17:52:21 UTC
  • mfrom: (1.1.48) (3.5.44 sid)
  • Revision ID: package-import@ubuntu.com-20120721175221-53m5pclzo992kawy
Tags: 2.0.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# Copyright @ 2012 Felix Paul Kühne <fkuehne at videolan dot org>
 
3
#
 
4
# This program is free software; you can redistribute it and/or modify it
 
5
# under the terms of the GNU Lesser General Public License as published by
 
6
# the Free Software Foundation; either version 2.1 of the License, or
 
7
# (at your option) any later version.
 
8
#
 
9
# This program is distributed in the hope that it will be useful,
 
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 
12
# GNU Lesser General Public License for more details.
 
13
#
 
14
# You should have received a copy of the GNU Lesser General Public License
 
15
# along with this program; if not, write to the Free Software Foundation,
 
16
# Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 
17
 
 
18
info()
 
19
{
 
20
    local green="\033[1;32m"
 
21
    local normal="\033[0m"
 
22
    echo "[${green}codesign${normal}] $1"
 
23
}
 
24
 
 
25
usage()
 
26
{
 
27
cat << EOF
 
28
usage: $0 [options]
 
29
 
 
30
Sign VLC.app in the current directory
 
31
 
 
32
OPTIONS:
 
33
   -h            Show this help
 
34
   -i            Identity to use
 
35
   -t            Entitlements file to use
 
36
   -g            Enable additional magic
 
37
EOF
 
38
 
 
39
}
 
40
 
 
41
while getopts "hi:t:g" OPTION
 
42
do
 
43
     case $OPTION in
 
44
         h)
 
45
             usage
 
46
             exit 1
 
47
         ;;
 
48
         i)
 
49
             IDENTITY=$OPTARG
 
50
         ;;
 
51
         t)
 
52
             OPTIONS="--entitlements $OPTARG"
 
53
         ;;
 
54
         g)
 
55
             GK="yes"
 
56
         ;;
 
57
     esac
 
58
done
 
59
shift $(($OPTIND - 1))
 
60
 
 
61
if [ "x$1" != "x" ]; then
 
62
    usage
 
63
    exit 1
 
64
fi
 
65
 
 
66
if test -z "$GK"
 
67
then
 
68
    info "Signing the executable"
 
69
    codesign --force --sign "$IDENTITY" $OPTIONS VLC.app/Contents/MacOS/VLC
 
70
 
 
71
    info "Signing the modules"
 
72
    find VLC.app/Contents/MacOS/plugins/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS '{}' \;
 
73
 
 
74
    info "Signing the libraries"
 
75
    find VLC.app/Contents/MacOS/lib/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS '{}' \;
 
76
 
 
77
    info "Signing the lua stuff"
 
78
    find VLC.app/Contents/MacOS/share/lua/* -name *luac -type f -exec codesign --force -s "$IDENTITY" $OPTIONS '{}' \;
 
79
else
 
80
    info "Signing the executable"
 
81
    codesign --force --sign "$IDENTITY" $OPTIONS --requirements "=designated => anchor apple generic  and identifier \"org.videolan.vlc\" and ((cert leaf[field.1.2.840.113635.100.6.1.9] exists) or ( certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists  and certificate leaf[subject.OU] = \"75GAHG3SZQ\" ))" VLC.app/Contents/MacOS/VLC
 
82
 
 
83
    info "Signing the modules"
 
84
    find VLC.app/Contents/MacOS/plugins/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS --requirements "=designated => anchor apple generic  and identifier \"org.videolan.vlc\" and ((cert leaf[field.1.2.840.113635.100.6.1.9] exists) or ( certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists  and certificate leaf[subject.OU] = \"75GAHG3SZQ\" ))" '{}' \;
 
85
 
 
86
    info "Signing the libraries"
 
87
    find VLC.app/Contents/MacOS/lib/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS --requirements "=designated => anchor apple generic  and identifier \"org.videolan.vlc\" and ((cert leaf[field.1.2.840.113635.100.6.1.9] exists) or ( certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists  and certificate leaf[subject.OU] = \"75GAHG3SZQ\" ))" '{}' \;
 
88
 
 
89
    info "Signing the lua stuff"
 
90
    find VLC.app/Contents/MacOS/share/lua/* -name *luac -type f -exec codesign --force -s "$IDENTITY" $OPTIONS --requirements "=designated => anchor apple generic  and identifier \"org.videolan.vlc\" and ((cert leaf[field.1.2.840.113635.100.6.1.9] exists) or ( certificate 1[field.1.2.840.113635.100.6.2.6] exists and certificate leaf[field.1.2.840.113635.100.6.1.13] exists  and certificate leaf[subject.OU] = \"75GAHG3SZQ\" ))" '{}' \;
 
91
fi
 
92
 
 
93
info "all items signed, validating..."
 
94
 
 
95
info "Validating binary"
 
96
codesign --verify VLC.app/Contents/MacOS/VLC
 
97
 
 
98
info "Validating modules"
 
99
find VLC.app/Contents/MacOS/plugins/* -type f -exec codesign --verify '{}' \;
 
100
 
 
101
info "Validating libraries"
 
102
find VLC.app/Contents/MacOS/lib/* -type f -exec codesign --verify '{}' \;
 
103
 
 
104
info "Validating lua stuff"
 
105
find VLC.app/Contents/MacOS/share/lua/* -name *luac -type f -exec codesign --verify '{}' \;
 
106
 
 
107
info "Validation complete"