Welcome to the ultimate guide to creating and maintaining a Cydia repo on a Mac. Before you start you will need to download and install the following tools. You must also have xcode and X11. I will not go into details on getting those in this tutorial.
1.
Fink
Clicking the link above will take you to Fink's download page. If you are on 10.6 (Like me) or 10.6, this task will be a bit harder as you have to download the source and compile it. If you are on 10.5 or 10.4, you can just download the binary installer.
2.
My Repo Files
These are some of the files that will be needed when you are building the repo, including the language control, a depiction framework, and the modded dpkg-scanpackages file.
3.
Misc Repo Files
This one isn't really required. It's just a collection of control and package index files from famous repos. I'm hoping that with the help of these (And many other things), we can crack the secret of paid packages and super user with no password for packages on the default repo.
4.
DS Store Remover
Needed for removing those pesky DSSTORE files that plague your repo folders.
Section One
Installing Fink and the necessary command line tools.
Part 1: Installing Fink.
For 10.6 and up.
Quote:
Move the downloaded archive to your desktop and extract it.
Then run the following commands in a terminal window:
cd Desktop/fink-0.32.2
./bootstrap
To start the installation.
After the installation is completed, running the command
/sw/bin/pathsetup.sh
Will set up your environment for Fink (assuming you have installed Fink
under /sw). If you open a new terminal window, the session will use these
environment settings. Once you have installed fink and the other base
packages, the command sequences:
fink selfupdate-rsync
fink index -f
|
For 10.5 and below.
Quote:
Double-click "Fink-0.9.0-XYZ-Installer.dmg" (where XYZ is either PowerPC or Intel) to mount the disk image, then double-click the "Fink 0.9.0 XYZ Installer.pkg" package inside. Follow the instructions on screen.
At the end of the installation, the pathsetup utility will be launched. You will be asked for permission before your shell's configuration files are edited. When the utility has finished, you are set to go!
Open a new Terminal.app window and run the following: "fink scanpackages; fink index"
Once those two commands are finished you should update the fink package, in case there have been significant changes since the last point release. After you do this you can install other packages. There are several ways to do this:
Use the included Fink Commander to select and install packages. Fink Commander provides an easy to use GUI for Fink. This is the recommended method for new users, or users who are not comfortable with the command line. Fink Commander has Binary and Source menus. You should install from binaries if you don't have the Developer Tools installed, or don't want to build packages yourself.
The Fink Commander sequence to update fink from binaries is as follows:
Binary->Update descriptions
Select the fink package.
Binary->Install
The recommended Fink Commander sequence to update fink from source is as follows:
Source->Selfupdate
Tools->Interact with Fink...
Make sure "Accept default response" is selected, and click "Submit".
fink and other base packages will be built and run automatically
Now that you've updated fink, you can install other packages.
To install from binaries, select the package, and use Binary->Install.
To install from source, select the package, and use Source->Install
Use apt-get. Apt-get will fetch and install binary packages for you, saving compiling time. You should either use this method or the Fink Commander binary method (above) if you don't have the Developer Tools installed.
To update fink open a Terminal.app window and type sudo apt-get update ; sudo apt-get install fink
Once you've updated fink, you can install other packages, using the same syntax, e.g sudo apt-get install gimp to install the Gimp. Note, however, that not all fink packages are in binary form.
Install from source (requires the Xcode Tools [Developer Tools on 10.2] to be installed). To update fink run fink selfupdate. When prompted, select option (1), "rsync". This will automatically update the fink package.
Once fink is updated, you can use "fink install" to fetch and compile from source code. For example, to install the Gimp, run fink install gimp.
|
Quoted (And modified) from the Fink website.
Part 2: Installing the necessary command line tools
Code:
fink install gzip bzip2 gnupg
Section Two
Building a package.
First, make a folder on your desktop called MyPackage. Inside that folder you'll want to put a folder matching a folder on the iphone filesystem. For example, I want to put my .app file in the Applications folder on the iPhone. I just put a folder called Applications inside MyPackage and when the package is installed, it will pop the app into /Applications. In Unix, CaPiTaLiZaTiOn matters!
Example file tree from Saurik.
+- MyProgram
+- Applications
| +- MyProgram.app
| +- Info.plist
| +- MyProgram
| +- icon.png
+- DEBIAN
| +- control
+- System
+- Library
+- LaunchDaemons
+- com.saurik.MyProgram.plist
Now, make a folder called DEBIAN inside MyPackage. This will be for the control information. Inside that folder we can have files called postrm, prerm, postinst, and preinst. These are bash scripts for changing or removing files for other things. For example:
Contents of file prerm:
#!/bin/bash
cd /var/mobile/Library/Preferences/
rm info.turbotweaks.fcsets.plist
The other thing that is in the DEBIAN folder is control. It is a required file. Here are the basics to building one:
Quote:
Package: com.yourcompany.yourpackage
Name: The Name Of Your Package Here
Version: The Version Of Your Package Here
Architecture: iphoneos-arm
Description: Short Description Of Your Package Here
Long Description Of Your Package Here
Homepage: h*tp://Your HomePage Here
Conflicts: com.conflictingcompany.conflictingpackagehere
Replaces: com.somecompany.some-package-that-this-package-will-replace-here
Depends: com.somecompany.some-package-that-this-package-needs-to-operate-here
Pre-Depends: firmware <=5.0>
Maintainer: You *<*your@email.com*>* //Remove *
Author: You *<*your@email.com*>* //remove *
Sponsor: If some one sponsors you. (No? Delete this line) *<*h*tp://sponsorsite.url*>* //Remove *
Section: Whatever you want to call this(Maybe your repo title)
Priority: extra
Depiction: h*tp://yourdepictionurl.url //Remove *
Tag: purpose::extension
dev: You
Installed-Size: Size of uncompressed package ex. 499999999 (In Kilobytes)
|
Make sure you have a blank space after that last line. Make sure the file is in plain text. Make sure the file has no extension. Now pump the MyPackage folder into DS Store Cleaner and blow those ds store files away.
Now, run this in terminal to convert your package to a deb file.
Code:
cd Desktop
dpkg-deb -b MyPackage /com.yourcompany.mypackage_version_iphoneos-arm.deb
You've successfully built your first package.
Section Three
Building the repo.
Create a folder called "repo" on your desktop. Make a folder called "files" in it. Put all your debian packages in there. For example, the MyPackage deb you created earlier. Put the en_US.gz file you downloaded at the beginning of the tutorial in the folder. Put in your forty by sixty pixel repo icon(If you have one. Ask Mr.x to make you one if you don't.) in the folder and call it CydiaIcon.png.
Type this in a fresh terminal window:
Code:
cd Desktop
cd repo
dpkg-scanpackages files / > Packages
bzip2 -fks Packages
gzip -fc Packages
Quote:
Origin: Your Repo Title
Label: Your Repo Title
Suite: stable
Version: 1.0
Codename: Your Repo Code Name
Architecture: iphoneos-arm
Components: main
Description: Description of your repo.
MD5Sum:
Md5Sum SizeInBytes Packages
Md5Sum SizeInBytes Packages.bz2
Md5Sum SizeInBytes Packages.gz
|
Example Entry for Md5Sum area:
1ab78q05806d41659fa3c5ac8c81566a 1387 Packages
Save it as "Release" with no extension in the "repo" folder.
Finally, the part you've all been waiting for, the part Saurik was very skeptical on, Signing the repo with GnuPgP.
Type this in terminal:
Choose option 3. Then hit enter.
Type in 1024. Then hit enter.
Type in 0. Then hit enter.
Type y. Then hit enter.
Type your name. Then hit enter.
Type your email. Then hit enter.
Type in "Cydia GPG". Then hit enter.
Type o and enter.
Then put in a good password and hit enter.
Type this in terminal:
Code:
cd Desktop
cd repo
gpg -abs -o Release.gpg Release
gpg --list-keys
gpg --export pub.gpg
After --export, type the name of the only pub key in the list. Ex: CAA75431
Make a package with a postinst of this:
Code:
#!/bin/bash
echo "Making directories…"
mkdir Pub
echo "Done making directories!"
echo "Changing directories…"
cd /Pub
echo "Done changing directories!"
echo "Downloading GPG…"
wget ht*p://yoursite.com/CydiaGPG/Release.pub
echo "Done downloading GPG!"
echo "Trusting GPG…"
apt-key add Release.pub
mv Release.pub /etc/apt/trusted.gpg.d/RepoName.gpg
echo "Done trusting GPG!"
echo "Cleaning up…"
cd /
rmdir Pub
echo "Done cleaning up!"
exit 0
Also, host the public key on your website so the package can access it. Make the Package depends on apt-key and wget.
Section 4
Section Icons
Remember that repo-prep package you make for the gpg key? Lets build on it.
In that folder, create another folder called "Applications". In that folder create a folder called Cydia.app. Hit add extension and it will turn into an app with an anti sign of it. Right click it and click "Show Package Contents". Then make a folder called "Sections". In that folder put your repo icon in there and title it The ExAcT NaMe of your section section in cydia. The extension must be png. Blow away the ds store files, update the version number in the control file, compile it, put it in the "files" folder and do the dpkg-scanpackages command. Blow away ds stores again and upload your repo to your website.
That's it! Now just add your repo in cydia and keep updating it with new packages!