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 REQUIREMENT="=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\" ))"
82 info "Signing the executable"
83 codesign --force --sign "$IDENTITY" $OPTIONS --requirements "$REQUIREMENT" VLC.app/Contents/MacOS/VLC
85 info "Signing the modules"
86 find VLC.app/Contents/MacOS/plugins/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS --requirements "$REQUIREMENT" '{}' \;
88 info "Signing the libraries"
89 find VLC.app/Contents/MacOS/lib/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS --requirements "$REQUIREMENT" '{}' \;
91 info "Signing the lua stuff"
92 find VLC.app/Contents/MacOS/share/lua/* -name *luac -type f -exec codesign --force -s "$IDENTITY" $OPTIONS --requirements "$REQUIREMENT" '{}' \;
95 info "all items signed, validating..."
97 info "Validating binary"
98 codesign --verify VLC.app/Contents/MacOS/VLC
100 info "Validating modules"
101 find VLC.app/Contents/MacOS/plugins/* -type f -exec codesign --verify '{}' \;
103 info "Validating libraries"
104 find VLC.app/Contents/MacOS/lib/* -type f -exec codesign --verify '{}' \;
106 info "Validating lua stuff"
107 find VLC.app/Contents/MacOS/share/lua/* -name *luac -type f -exec codesign --verify '{}' \;
109 info "Validation complete"