Daniel Meese's Blog


Creating a Cydia Repository from your iPhone

Repositories are what let us get all those invaluable packages through Cydia to improve our jailbroken iDevices. There are a quite a few tutorials out there that tell you how to create a Cydia repository on a Mac or PC, but I figure it’s sometimes more convenient to make/update a repository on the go. I realize this it is time consuming to use your mobile device for these types of things, but hey, nobody has written a tutorial on how to do this yet.
If you want to create a repository on Linux, go here, OS X here.

This is what you will need to create a repository on your iDevice:
jailbroken iDevice (I am assuming you are on 4.x, but everything should work fine otherwise.)
iFile ($4 from Cydia)
an FTP app (I am using FTPontheGo for this tutorial)
MobileTerminal (for this tutorial, I am using this one. It must support copy/paste.)
EDIT: Use Prompt for iPhone ($5) instead of MobileTerminal if you want complete functionality (set host to “localhost”, username to “root” and password to your root password.)
coreutils (from Cydia)
bzip2 (from cydia)
a server

1. Making a .deb Package

A. Configure Folder Hierachy
Once you have all of that installed, you need to create a package to go on your repo. First, you’re going to need to open iFile and navigate to var/mobile/Documents/.
Tap “edit”, tap “+” and create a folder called “cydia”.
Create a folder in var/mobile/Documents/cydia/ called “mp” (stands for “My Package”). Open mp/ and create two more directories: “DEBIAN” and “Applications”
[NOTE: At this point, you can create any series of folders within mp/ that will direct to desired install location within your filesystem. i.e. "mp/Library/Themes/YourWinterBoardTheme.theme". P.S. Never install to var/stash/]

B. Make the control File
Open mp/DEBIAN/ and create a file called “control”. Open it, and add the following fields (Make sure you have an empty final line):

Package: com.yourname.mp
Name: My Package
Version: 1.0.4-1
Architecture: iphoneos-arm
Description: This is a one-line description of your page.
Homepage: http://www.yourwebsite.com/
Depiction: http://www.yourwebsite.com/mp.html
Maintainer: Your Name
Author: Name of package author
Sponsor: Repo sponsor
Section: Section title

For the “Depiction” field, you should put a link to a page made specifically for your package. You can use iwebkit or some other mobile formatting tool to make your depiction page work well in Cydia.

C. Getting Ready to Build the Package
For this step, you’re going to need a copy/paste-capable version of MobileTerminal. At the time this tutorial was written, only beta 426 of MobileTerminal supports copy/paste. Go to http://code.google.com/p/mobileterminal/downloads/list (It is VERY buggy and feature-deficient, but it has copy/paste and it supports 3.x and 4.x unlike the stable version.)
Transfer MobileTerminal 426 over to the device via SSH, iTunes file sharing or some USB iPhone file transfer program. Find it in iFile, tap it, and tap “Installer”. It will install and you are now ready to package packages. To install the .deb file via SSH see this tutorial.

D. Building the Package
Open MobileTerminal, enter “cd Documents/cydia” and—making sure that your package is how you want it—enter “dpkg-deb -b mp”. You will get four warnings about “user-defined fields” but that is expected, so do not fret.

2. Making the Packages.bz2 File

A. Creating the Packages File
Create a file named “Packages” in your var/mobile/Documents/cydia/ folder. Open the control files of any packages you’re going to have on your repo into the “Packages” file, separated by a blank space.

B. Fillin’ in the Spaces
Add the following lines in each package’s control data within “Packages”:

Filename: ./deb/

For Filename, you’re going to put “./deb/mp.deb”, or replace “mp.deb” with whatever your package is named.

For Size, go into iFile, find the deb package concerned, and tap the blue circle to the right of the filename. Scroll down to size, and it will show “X bytes” put whatever number they show, without commas, beside the Size field in your Packages file.

For MD5sum, open MobileTerminal and enter “cd Documents/cydia” and then “md5sum mp.deb”. Copy the jumbled letters and numbers that result from that command, and paste them beside the MD5sum field in Packages.

You can repeat step 2B for any number of packages. Just make sure their control data is separated by a blank line in the Packages file, and the file should end in a blank line.

C. Making Packages into a bzip2 Archive
Open MobileTerminal, do “cd Documents/cydia” and then “bzip2 Packages” (You may have to have root privileges to use bzip2. If so, type “su”, hit return and enter root password. Default is “alpine”.)

Now open iFile, tap your new Packages.bz2 file and “Unarchiver”. Now you have “Packages” and “Packages.bz2″

3. Making the Release file

Create a file called “Release” and paste the following text into it:

Origin: Your Repository
Label: Your Repo
Suite: stable
Version: 1.0
Codename: yourrepository
Architectures: iphoneos-arm
Componenets: main
Description: Hacks and Themes

Below are descriptions of what each field does:
Origin: This is the long name of your source. It will show up when you go to Manage>sources in Cydia.
Label: This is a shorter name for your repo that will appear beneath the name of each package that belongs to your repo.
Suite: Just put stable…
Version: Increase this number whenever you update your repository…if you want. It doesn’t really matter.
Codename: concise, non-spaced name for your repo
Architectures: Currently, all iDevices are iphoneos-arm, so just put “iphoneos-arm”.
Components: Put “main”. Even Saurik doesn’t even know if it’s required.
Description: Exactly that…a description.

Save Release and get ready for step 4, where all the magic is manifest!

4. Uploading Your Source Files.

On your server, create a folder called whatever you’d like (i.e. “repo”, “cydia”, “apt”) and create a folder called “deb” within your repo folder. Now, upload the following files into your repo directory:
….and upload all of your .deb packages into the deb folder.

5. Add your repository in Cydia>Manage>Sources>edit>”+”
Check for errors in that annoying Bubble that pops up once data is done reloading, and fix any errors! (P.S. You have to edit the Packages files whenever you add more packages, and you also have to bzip2 it and re-upload both Packages and Packages.bz2)

I hope this tutorial was very clear and presented a realistic way for you to create/update your repo directly from your iPhone.