I’ve created a simple Perl script which automatically builds your .deb files and compiles your Cydia Repository. Never bzip and gzip the ‘Packages’ file in the console again, never calculate and enter the md5 hashes by hand again. Here is a step-by-step tutorial:
(By the way, check out my own repository: http://patrickmuff.ch/repo/. It has some cool lockscreen themes on it, like this, this and this.)
Download and install Ubuntu
Download a 32-bit version of Ubuntu on this site. Install it in a virtual machine. I used VMWare Fusion on OS X and VMWare Player on Windows to do this.
Set up your Ubuntu
Simply install it like you would install an operating system. Now download this zip archive. Unzip it and drag it onto your Ubuntu desktop. You now need to install dpkg-scanpackages and dpkg-gettext.pl. To do that, start a terminal, authenticate yourself and navigate to the desktop:
sudo -s cd Desktop/
Copy dpkg-scanpackages to /usr/bin
cp dpkg-scanpackages /usr/bin
Give it some rights with chmod
chmod 0777 /usr/bin/dpkg-scanpackages
Now do (nearly) the same with gettext.pl
cp dpkg-gettext.pl /etc/perl chmod 0777 /etc/perl/dpkg-gettext.pl
You need to configure GnuPG. Execute this command, then enter the following.
gpg --gen-key
1 1024 0 y Your Name (e.g. Johnny Depp) Your Email (e.g. johhny.depp@gmail.com) Comment (e.g. Pirate) o Passphrase (You need to enter this every time you compile the repository) Repeat your passphrase Now type random letters on your keyboard until something happens.
Create a *.deb package
Create a new folder and name it after your package. The subfolder structure should look like this:
+- MyTheme
+- DEBIAN
| +- control
+- Library
+- Themes
+- yourTheme.theme
“Library/Themes” can be any directory on your device. Got it? Now for that control file; Create a file without any extension and paste this into it:
Package: com.dislick.blur Name: Blur Lockscreen Version: 0.1 Architecture: iphoneos-arm Description: simple blurry lockscreen Depiction: URL. This webpage replaces the description in Cydia. If you don't want this, remove the entire line. Homepage: http://patrickmuff.ch Maintainer: Patrick Muff Author: Patrick Muff Section: Themes
Important! If you don’t add a new line at the bottom of the file, you will not be able to build it! So just press enter after the section line.
Great, your package is ready. You don’t need to build it by hand, my perl script will take care of this. The only thing you have to do now is copying this folder into your Ubuntu desktop and place it in repo/uncompiled-packages.
Customize your repository
Go the the repo/ folder and open up “Release-Template” with gedit or any other text editor. This file will be used to name your repository and pass a few metadata to Cydia. It also contains MD5 hashes of the three Packages files. Those are generated by my script, you don’t need to do it by hand.
Run the script
Go back to your Ubuntu terminal and make sure you’re in the repo folder. Do this by entering this command which will list every file and directory in your current folder:
ls
If you see a file called “compile-repo”, you’re good to go. If not, navigate back and forth with the “cd”-command.
perl compile-repo
This will compile your repository. To GnuPG encrypt the ‘Release’ file you need to enter the passphrase you defined before. After that, you’re done. Now upload the entire repo folder on a webspace and enter the URL in Cydia!
In case you are an advanced user and are just interested in the perl script:
#!/usr/bin/env perl
# Author: Patrick Muff <muff.pa@gmail.com>
# Purpose: Compiles a Cydia repository
use Digest::MD5;
sub md5sum {
my $file = shift;
my $digest = "";
eval {
open(FILE, $file) or die "Can't find file $file\n";
my $ctx = Digest::MD5->new;
$ctx->addfile(*FILE);
$digest = $ctx->hexdigest;
close(FILE);
};
if ($@) {
print $@;
return "";
}
return $digest;
}
# build packages into deb/
system("chmod 0755 uncompiled-packages/ -R");
my $directory = 'uncompiled-packages/';
opendir (DIR, $directory) or die $!;
while (my $file = readdir(DIR)) {
system("dpkg -b uncompiled-packages/".$file." deb/".$file.".deb");
}
closedir(DIR);
# scan the packages and write output to file Packages
system("dpkg-scanpackages deb / > Packages");
# bzip2 it to a new file
system("bzip2 -fks Packages");
# gzip it
system("gzip -f Packages");
# scan again because we zipped the original file
system("dpkg-scanpackages deb / > Packages");
# calculate the hashes and write to Release
system("cp Release-Template Release");
open(RLS, ">>Release");
@files = ("Packages", "Packages.gz", "Packages.bz2");
my $output = "";
foreach (@files) {
my $fname = $_;
my $md5 = md5sum($fname);
my $size = -s $fname;
$output = $output.$md5." ".$size." ".$fname."\n";
};
print RLS $output;
close(RLS);
# remove Release.gpg
system("rm Release.gpg");
# generate Release.gpg
system("gpg -abs -o Release.gpg Release");
exit 0;
the command;
cp dpkg-scanpackages /usr/bin
does not work. it keeps saying that it is a unknown command via bash.
do i need any additional packages… i did every step you did…. and still having problems… please help.
http://en.wikipedia.org/wiki/Cp_(Unix)
You shouldn’t have any troubles with that.
Hyo, I have one question. Is the whole GnuPG encryption thing really necessary? I usually let Theos do all my packages and I can’t seem to find a benefit in doing them again.
Apologies for the double comment, but I’m running into problems at the time I run “perl compile-repo”.
I’m getting a few warnings and errors here. I don’t worry as much for the warnings because I read on Saurik’s site that they are to be expected, but I’m certain the errors aren’t supposed to pop up. Here’s an screenshot, showing how I run compile-repo and the specific errors (inside orange rectangles).
http://i44.tinypic.com/8wikpi.png
This is a problem because when I try to install my packages via Cydia via my own repo, I get 404 errors so I’m assuming the “Sideswitch” package isn’t being compiled at all.
It looks like you forgot the ‘control’ file for your packages. dpkg can’t run if you forget that file.
They all have it, but I have my repo up and working now.
It will complain my packages have no control file, despite putting them in DEBIAN/control, but it builds the packages anyway.
That’s weird. Please let me know if you find out what causes this.
Hello Patrick
Have you found the cause of the problem from above, because I’m facing the exact same problem…
It creates the deb but with warnings.
At the end it also says that I need to enter the passphrase, but I’m not sure when to enter it or with which command to pass it through.
Thx for your help in advance,
Best regards Jorit
@Jorit
Sorry, I couldn’t find it (yet).
You can just enter it when it asks you for it and then press enter. After that the process is done and your repo should run.
Hey there,
When i try and run the version of dpkg-scanpackages you provided i’m getting the following errors:
Use of uninitialized value $binarydir in -d at /usr/bin/dpkg-scanpackages line 103.
Use of uninitialized value $binarydir in sprintf at /usr/bin/dpkg-scanpackages line 103.
Binary dir not found
I am using linux Backtrack.
Any idea what could be the problem ?