]> git.sesse.net Git - vlc/blob - extras/package/macosx/codesign-dp.sh
macosx: expand Subtitles menu for on-the-fly changes of text size, text color, backgr...
[vlc] / extras / package / macosx / codesign-dp.sh
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 Delete_Preferences.app in the current checkout
31
32 OPTIONS:
33    -h            Show this help
34    -i            Identity to use
35    -g            Enable additional magic
36 EOF
37
38 }
39
40 while getopts "hi:g" OPTION
41 do
42      case $OPTION in
43          h)
44              usage
45              exit 1
46          ;;
47          i)
48              IDENTITY=$OPTARG
49          ;;
50          g)
51              GK="yes"
52          ;;
53      esac
54 done
55 shift $(($OPTIND - 1))
56
57 if [ "x$1" != "x" ]; then
58     usage
59     exit 1
60 fi
61
62 if test -z "$GK"
63 then
64     info "Signing the executable"
65     codesign --force --sign "$IDENTITY" $OPTIONS extras/package/macosx/Delete_Preferences.app/Contents/MacOS/applet
66
67     info "Signing Resources"
68     find extras/package/macosx/Delete_Preferences.app/Contents/Resources/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS '{}' \;
69 else
70     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\" ))"
71
72     info "Signing the executable"
73     codesign --force --sign "$IDENTITY" $OPTIONS --requirements "$REQUIREMENT" extras/package/macosx/Delete_Preferences.app/Contents/MacOS/applet
74
75     info "Signing Resources"
76     find extras/package/macosx/Delete_Preferences.app/Contents/Resources/* -type f -exec codesign --force -s "$IDENTITY" $OPTIONS --requirements "$REQUIREMENT" '{}' \;
77 fi
78
79 info "all items signed, validating..."
80
81 info "Validating binary"
82 codesign --verify extras/package/macosx/Delete_Preferences.app/Contents/MacOS/applet
83
84 info "Validating Resources"
85 find extras/package/macosx/Delete_Preferences.app/Contents/Resources/* -type f -exec codesign --verify '{}' \;
86
87 info "Validation complete"