Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
Diatrus committed Apr 4, 2019
1 parent e55a095 commit d5d868a
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Install
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
#SignApp Install script v1.5
if ! type dpkg &>/dev/null; then
if type brew &>/dev/null; then
echo "Installing dpkg with Homebrew..."
brew install dpkg
elif type port &>/dev/null; then
echo "Installing dpkg with MacPorts..."
sudo port install dpkg
else
echo "Installing Homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo "Installing dpkg with Homebrew..."
brew install dpkg
fi
fi
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd "$DIR"
curl --silent -LJO https://raw.githubusercontent.com/Diatrus/SignApp/master/Resources/SignApp > SignApp
curl --silent -LJO https://raw.githubusercontent.com/Diatrus/SignApp/master/Resources/ldid2 > ldid2
sudo mv "SignApp" "/usr/bin/SignApp"
sudo mv "ldid2" "/usr/bin/ldid2"
sudo chmod 0777 /usr/bin/SignApp
sudo chmod 0777 /usr/bin/ldid2
echo "Success! SignApp can now be run anywhere!"
echo "Run this script again anytime to update SignApp."
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SignApp
SignApp is a simple, minimal footprint script that will extract an IPA and repack it into a deb made for installing on an Apple TV or iOS device respectively.

## How does it work?
SignApp extracts an IPA, takes needed info from the info.plist to create a specialized control file, adds entitlements to the main binary and frameworks (so the app can be ran as root), then repacks it back into an ipa

## Instructions
1. Download the latest Installer from the releases page.
2. Simply double click the Installer, type your password when prompted, and let the script install SignApp and its dependencies.
3. Run SignApp [/path/to/ipa] to repack your IPA.

## Installer Info
The Installer script will automatically check for all dependancies and install them if needed using the package manager you currently have installed (Homebrew or MacPorts). If you do not have a package manager installed, it will install Homebrew and then the dependancies.

## Updating
Simply rerun the Installer script. It automatically pulls the latest SignApp from Github and installs it
Binary file added Resources/.DS_Store
Binary file not shown.
59 changes: 59 additions & 0 deletions Resources/SignApp
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#!/bin/bash

# SignApp. Used to correctly and automatically create deb files of tvOS or iOS apps that can be run from /Applications.

#Check dependancies
if ! type dpkg &>/dev/null; then
echo "Please install dpkg."
fi
if ! type ldid2 &>/dev/null; then
echo "Please install ldid2."
fi
if [ ! -d "$HOME/Documents/SignApp" ]; then
mkdir "$HOME/Documents/SignApp"
fi

#Actual script
FILENAME="$1"
if [ -z "$1" ]; then
echo "Usage: SignApp [IPA]"
else
if [ ! -f "$FILENAME" ]; then
echo "File not found!"
else
cp "$FILENAME" "$HOME/Documents/SignApp/$FILENAME"
cd "$HOME/Documents/SignApp"
find . -type d -exec rm -rf '{}' \; 2> /dev/null
echo "Extracting IPA"
unzip -qq "$FILENAME"
rm -rf __MACOSX
cd Payload
APPDIR=$(find . -type d -name "*.app")
cd ..
chmod -R +x Payload
mv Payload/"$APPDIR" "$APPDIR"
rm -rf Payload
rm -rf "$APPDIR"/_CodeSignature &>/dev/null
rm -f "$APPDIR"/embedded.mobileprovision &>/dev/null
find . -name ".DS_Store" -depth -exec rm {} \;
echo "Getting app version..."
VERSION=$(/usr/libexec/plistbuddy -c 'print CFBundleShortVersionString' ${APPDIR}/Info.plist)
BUILD=$(/usr/libexec/plistbuddy -c 'print CFBundleVersion' ${APPDIR}/Info.plist)
FIRMWARE=$(/usr/libexec/plistbuddy -c 'print MinimumOSVersion' ${APPDIR}/Info.plist)
BUNDLEID=$(/usr/libexec/plistbuddy -c 'print CFBundleIdentifier' ${APPDIR}/Info.plist)
NAME=$(/usr/libexec/plistbuddy -c 'print CFBundleName' ${APPDIR}/Info.plist)
PLATFORM=$(/usr/libexec/plistbuddy -c 'print DTPlatformName' ${APPDIR}/Info.plist)
BUNDLENAME=$(/usr/libexec/plistbuddy -c 'print CFBundleDisplayName' ${APPDIR}/Info.plist)
echo "$VERSION"-"$BUILD"
echo "Downloading entitlements..."
curl --silent https://raw.githubusercontent.com/Diatrus/SignApp/master/Resources/entitlements.xml > entitlements.xml
echo "Adding entitlements..."
find "$APPDIR" -perm +111 -type f -not -name "*.html" -not -name "*.css" -not -name "*.js" -exec ldid2 -Sentitlements.xml {} &>/dev/null \;
rm -f entitlements.xml
echo "Packaging ipa..."
mkdir Payload
mv "$APPDIR" Payload/"$APPDIR"
zip -qq Payload
mv Payload.zip "$BUNDLEID".ipa
fi
fi
14 changes: 14 additions & 0 deletions Resources/entitlements.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.private.security.no-container</key>
<true/>
<key>com.apple.private.skip-library-validation</key>
<true/>
<key>get-task-allow</key>
<true/>
<key>platform-application</key>
<true/>
</dict>
</plist>
Binary file added Resources/ldid2
Binary file not shown.

0 comments on commit d5d868a

Please sign in to comment.