Skip to content

Instantly share code, notes, and snippets.

@felix-schwarz
Last active August 16, 2024 05:27
Show Gist options
  • Select an option

  • Save felix-schwarz/f8c83a6ebef0a7bb9dfa to your computer and use it in GitHub Desktop.

Select an option

Save felix-schwarz/f8c83a6ebef0a7bb9dfa to your computer and use it in GitHub Desktop.

Revisions

  1. felix-schwarz revised this gist Aug 6, 2014. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion SignAndPackageForMAS.sh
    Original file line number Diff line number Diff line change
    @@ -54,7 +54,6 @@ PKG_PATH="../distribution/RemoteBuddyExpress.pkg"
    ## Sign
    echo "== SIGNING COCOA BUNDLES =="
    find "$APP_BUNDLE_PATH" -name "*.bundle" -exec echo "Will sign" {} \;
    echo "Signing.."
    find "$APP_BUNDLE_PATH" -name "*.bundle" -exec /usr/bin/codesign $APP_SIGN_OPTIONS "$APP_SIGN_IDENTITY" {} \;

    echo ""
  2. felix-schwarz revised this gist Aug 6, 2014. 1 changed file with 12 additions and 5 deletions.
    17 changes: 12 additions & 5 deletions SignAndPackageForMAS.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    #
    # SignAndPackageForMAS.sh v1.0
    # SignAndPackageForMAS.sh v1.0.1
    #
    # Codesign an app bundle and build a signed package ready for submission to the
    # Mac App Store
    @@ -33,6 +33,13 @@
    # (use Keychain Access.app to get the name of yours)
    APP_SIGN_IDENTITY="3rd Party Mac Developer Application: IOSPIRIT GmbH (UH96K9N25C)"

    # Options passed to codesign. If the app bundle (and its binaries) that you
    # provide has already been signed and contains metadata (such as entitlements
    # and requirements) that you want to re-use, be sure to add "--preserve-metadata".
    # For more info on codesign options, please consult the man page for codesign.
    # (thanks @danielpunkass for pointing out this omission)
    APP_SIGN_OPTIONS="--force --sign"

    # The name of the identity to use for signing the app and its contents
    # (use Keychain Access.app to get the name of yours)
    INSTALLER_SIGN_IDENTITY="3rd Party Mac Developer Installer: IOSPIRIT GmbH (UH96K9N25C)"
    @@ -47,16 +54,17 @@ PKG_PATH="../distribution/RemoteBuddyExpress.pkg"
    ## Sign
    echo "== SIGNING COCOA BUNDLES =="
    find "$APP_BUNDLE_PATH" -name "*.bundle" -exec echo "Will sign" {} \;
    find "$APP_BUNDLE_PATH" -name "*.bundle" -exec /usr/bin/codesign --force --sign "$APP_SIGN_IDENTITY" {} \;
    echo "Signing.."
    find "$APP_BUNDLE_PATH" -name "*.bundle" -exec /usr/bin/codesign $APP_SIGN_OPTIONS "$APP_SIGN_IDENTITY" {} \;

    echo ""
    echo "== SIGNING FRAMEWORKS =="
    find "$APP_BUNDLE_PATH" -name "*.framework" -exec echo "Will sign" {}/Versions/A \;
    find "$APP_BUNDLE_PATH" -name "*.framework" -exec /usr/bin/codesign --force --sign "$APP_SIGN_IDENTITY" {}/Versions/A \;
    find "$APP_BUNDLE_PATH" -name "*.framework" -exec /usr/bin/codesign $APP_SIGN_OPTIONS "$APP_SIGN_IDENTITY" {}/Versions/A \;

    echo ""
    echo "== SIGNING $APP_BUNDLE_PATH =="
    /usr/bin/codesign --force --sign "$APP_SIGN_IDENTITY" "$APP_BUNDLE_PATH"
    /usr/bin/codesign $APP_SIGN_OPTIONS "$APP_SIGN_IDENTITY" "$APP_BUNDLE_PATH"

    echo ""
    echo "== PACKAGING =="
    @@ -67,4 +75,3 @@ echo ""
    echo "== THAT'S ALL FOLKS! =="

    # Done

  3. felix-schwarz renamed this gist Aug 6, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion SignAndBundleForMAS.sh → SignAndPackageForMAS.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash

    #
    # SignAndBundleForMAS.sh v1.0
    # SignAndPackageForMAS.sh v1.0
    #
    # Codesign an app bundle and build a signed package ready for submission to the
    # Mac App Store
  4. felix-schwarz created this gist Aug 6, 2014.
    70 changes: 70 additions & 0 deletions SignAndBundleForMAS.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,70 @@
    #!/bin/bash

    #
    # SignAndBundleForMAS.sh v1.0
    #
    # Codesign an app bundle and build a signed package ready for submission to the
    # Mac App Store
    #
    # Copyright (c) 2014 Felix Schwarz (@felix_schwarz), IOSPIRIT GmbH (@iospirit)
    #
    # Permission is hereby granted, free of charge, to any person obtaining a copy
    # of this software and associated documentation files (the "Software"), to deal
    # in the Software without restriction, including without limitation the rights
    # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    # copies of the Software, and to permit persons to whom the Software is
    # furnished to do so, subject to the following conditions:
    #
    # The above copyright notice and this permission notice shall be included in
    # all copies or substantial portions of the Software.
    #
    # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    # THE SOFTWARE.
    #

    ## Configuration

    # The name of the identity to use for signing the app and its contents
    # (use Keychain Access.app to get the name of yours)
    APP_SIGN_IDENTITY="3rd Party Mac Developer Application: IOSPIRIT GmbH (UH96K9N25C)"

    # The name of the identity to use for signing the app and its contents
    # (use Keychain Access.app to get the name of yours)
    INSTALLER_SIGN_IDENTITY="3rd Party Mac Developer Installer: IOSPIRIT GmbH (UH96K9N25C)"

    # Path to the app bundle to sign and build a MAS package from
    APP_BUNDLE_PATH="../distribution/Remote Buddy Express.app"

    # Path to store the completed package at (any pre-existing file at this path will be deleted)
    PKG_PATH="../distribution/RemoteBuddyExpress.pkg"


    ## Sign
    echo "== SIGNING COCOA BUNDLES =="
    find "$APP_BUNDLE_PATH" -name "*.bundle" -exec echo "Will sign" {} \;
    find "$APP_BUNDLE_PATH" -name "*.bundle" -exec /usr/bin/codesign --force --sign "$APP_SIGN_IDENTITY" {} \;

    echo ""
    echo "== SIGNING FRAMEWORKS =="
    find "$APP_BUNDLE_PATH" -name "*.framework" -exec echo "Will sign" {}/Versions/A \;
    find "$APP_BUNDLE_PATH" -name "*.framework" -exec /usr/bin/codesign --force --sign "$APP_SIGN_IDENTITY" {}/Versions/A \;

    echo ""
    echo "== SIGNING $APP_BUNDLE_PATH =="
    /usr/bin/codesign --force --sign "$APP_SIGN_IDENTITY" "$APP_BUNDLE_PATH"

    echo ""
    echo "== PACKAGING =="
    rm "$PKG_PATH"
    productbuild --component "$APP_BUNDLE_PATH" "/Applications" "$PKG_PATH" --sign "$INSTALLER_SIGN_IDENTITY"

    echo ""
    echo "== THAT'S ALL FOLKS! =="

    # Done