Table of Contents
Repo Man


Create your own Cydia repository (or 'Source'.)

Cydia uses a packaging system called Debian for its repositories.
A repository is a folder with a certain structure on a web server. It in turn contains special archives, called packages, which you can select in Cydia and install.

Packages can contain a collection of files and folders. The folder hierarchy in the package mirrors the hierarchy on the phone: the top level is equivalent to the top level of the package. WinterBoard themes, for example, are kept in /Library/Themes/ on the phone - to include one in a package, you would put it into a /Library/Themes/ folder in the package.

Repo Man makes building these packages very easy.
It takes care of all the special files and formats for you. However, it is a simplified way of making packages. It is not intended for industrial-strength use, and it is not intended for distribution of executable files - for those, there are additional issues like firmware versions and library dependencies that need to be considered.

Read more about the gory details from the creator of Cydia here.
Thank you to Mark at Hack That P<###X>hone, whose tutorial got me started on this.

Use Repo Man Packages are not Themes!
When you install a package, it replaces files and folders on the phone without backup. More importantly, when you uninstall a package, the files and folders will be deleted without replacement! Please keep that in mind. (You can, of course, make a package with the original files and install that one after uninstalling the customized files. This could get tricky, though.)

Requirements
You need a web server to host a repository. Look around online to learn how you can use your Mac as a web server.
You also need the Debian command line tools - please install Fink, if you haven't done so. Pick the version that is appropriate for your system. Fink will create an /sw folder with all the needed tools. To uninstall, simply delete this folder.

Create or Select a Repository
Select 'Select/Create Folder...' from the Repository menu. Create a new folder on disk (use 'New Folder...' in the options menu,) or select one that you created previously, then click 'OK'. This folder will contain the packages and the control files, as well as your final repository that you will copy onto your web server.

Enter the name, version and description of your repository in the repository section. This information will go into a 'Release' file and will be displayed in Cydia about your 'source'. (You can manage this file manually if you need to add additional fields - check the appropriate option in the repository menu.)

Create or Select a Package
The Package section lets you create and modify packages that are in your repository. Each package is represented by a folder of files which will be installed on the phone, and 'Package' and 'Control' text files with descriptive information.

Create a new package with the 'New Package...' option in the Package menu, or select one from the list of packages at the bottom of the menu.
iFuntastic loads fields with descriptive information into the list on the left, and shows the contents of the package in the file manager window on the right. Leave the DEBIAN folder alone. Now put files and folders into your package. Remember that the locations are relative to the locations on the phone. Drag files from another file manager window or from the Finder, Safari, iPhoto, iTunes etc. into the package.

Smart Copy
If the files you want to include in your package are on your device (such as a theme or web clip you just made,) then drag the file(s) onto the Smart Copy area under the package listing. iFuntastic will, starting at the package's top level, duplicate the folder hierarchy if necessary, and then copy the file(s) into the correct location.

One more item can help in making a hierarchy of nested folders: select New Hierarchy... from the options menu above the package listing and enter a path - again, iFuntastic will create all the subfolders for you. This time, though, it will be relative to the current folder. Aren't computers cool?

Descriptive Fields
The fields on the left should be fairly self-explanatory; here is some additional information.

Contact: If you add an e-mail address in angle brackets after your name in this field, then users can directly send you an e-mail from the 'Contact' field that is displayed as part of your package information.

Section: You can make up your own section or enter one of Cydia's sections (e.g. 'Ringtones' or 'Utilities'.)

More Info: If you enter a web address into the 'More Info' field, the page will be displayed when users tap on 'More Information' on the package information screen. If you check On Main Page, then the page will be displayed directly underneath the author field (so users can't possibly miss your advertising :-) (Technical Note: the address is put into the 'Depiction:' field in the Package file instead of the 'Homepage:' field.)

Check Respring to have Cydia restart the SpringBoard after installation or deinstallation of your package. Many changes (for example to the Wallpaper) require this to become active. (Technical Note: the 'Depends:' field is set to 'mobilesubstrate' rather than omitted.)

Icon: see below.

There are additional fields that can go into the Control and Package files. If you know what you are doing, then you can manage these files manually by checking the respective options in the Packages menu.

To rename or delete the current package, use the respective options in the Packages menu. Do this rather than doing it in the file manager - additional files need to be changed.

Update Package
This is where the convenience of iFuntastic comes in. Click this button when you're done making changes to your package. iFuntastic will update the 'Control' and Package' files with the information you entered into the fields (unless you chose to manage them manually.) It will add additional fields - the MD5 sum, package file size and package file name being the most important ones. Finally, it will remove any .DS_Store files that have crept into the package folder and then compress it into a .deb file, which is what becomes part of the repository.

Update Repository
When all your packages are ready (and updated,) then click 'Update Repository'. iFuntastic will put all the Package text files into a 'Packages' file - a list of all of your packages. It then compresses the file and puts the resulting Packages.gz file into the final repository folder. The final repository folder will have the same name as the main folder, but it will be inside of the main folder. The 'Release' file will be added, and a 'debs' folder will hold all the .deb package files.

Click Show in Finder to show the repository folder; then copy the final repository folder to the main level of your server.

The address of the repository (or Source) will be webserver/repository. This is the address you will have to enter as a source in Cydia -> Manage -> Sources. Tap 'Edit' and then 'Add' and enter the address. Tap 'Done', and your very own repository, along with your packages, should show up in Cydia!

Source, Section and Package Icons
The icons that Cydia displays for repositories and sections can be found in the Cydia application itself. It appears that the official way to add your own is by contacting 'saurik', the creator of Cydia. However, you can now create a package that installs your own icons! This is not quite satisfactory, but it'll do.

The icon for your repository (source) should be named address.png where address is the web address of your server (without the repository folder name.) The icon goes into /Applications/Cydia.app/Sources/.

If you use one of the standard sections for your package, then it already has an icon - otherwise, name the icon mySection.png, where mySection is the name of yes, your section. The icon goes into /Applications/Cydia.app/Sections/.

Lastly, the icon for your package can be any file on the phone - the default entry in the 'Icon' field points to the Cydia icon itself. Install your own icon somewhere and make this entry point to it.

Make your icons a separate package for a one-time installation, or just use iFuntastic to put them on the phone, if you'll be using your repository for your own pleasure.

Cydia Crashes!
Cydia appears a bit sensitive to mistakes in the 'Package' files, that is, in the descriptive fields. Sticking to ASCII characters is probably a good idea. I inadvertently left an important field blank, and Cydia crashed immediately after starting. That was a bit of a sweaty situation; I ended up re-installing Cydia by running QuickPwn again - so that is one (painful) solution. An easier solution is to navigate to /var/lib/apt/lists/ (which happens to have been added to the list of Device paths as Cydia Packages :-) and to delete the ._Packages and ._Release files whose names start with your server address.