2
# Copyright @ 2012 Felix Paul Kühne <fkuehne at videolan dot org>
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.
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.
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.
20
local green="\033[1;32m"
21
local normal="\033[0m"
22
echo "[${green}codesign${normal}] $1"
30
Sign VLC.app in the current directory
35
-t Entitlements file to use
36
-g Enable additional magic
41
while getopts "hi:t:g" OPTION
52
OPTIONS="--entitlements $OPTARG"
59
shift $(($OPTIND - 1))
61
if [ "x$1" != "x" ]; then
68
info "Signing the executable"
69
codesign --force --sign "$IDENTITY" $OPTIONS VLC.app/Contents/MacOS/VLC
71
info "Signing the modules"
72
find VLC.app/Contents/MacOS/plugins/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS '{}' \;
74
info "Signing the libraries"
75
find VLC.app/Contents/MacOS/lib/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS '{}' \;
77
info "Signing the lua stuff"
78
find VLC.app/Contents/MacOS/share/lua/* -name *luac -type f -exec codesign --force -s "$IDENTITY" $OPTIONS '{}' \;
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
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\" ))" '{}' \;
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\" ))" '{}' \;
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\" ))" '{}' \;
93
info "all items signed, validating..."
95
info "Validating binary"
96
codesign --verify VLC.app/Contents/MacOS/VLC
98
info "Validating modules"
99
find VLC.app/Contents/MacOS/plugins/* -type f -exec codesign --verify '{}' \;
101
info "Validating libraries"
102
find VLC.app/Contents/MacOS/lib/* -type f -exec codesign --verify '{}' \;
104
info "Validating lua stuff"
105
find VLC.app/Contents/MacOS/share/lua/* -name *luac -type f -exec codesign --verify '{}' \;
107
info "Validation complete"