Making Clients Connect to a Binary Distribution Server
Your central server is ready to distribute binary packages. Now you have to configure the clients to connect to this server. On each client, you have to take the following steps:
- Install Fink in the default path /sw.
- If you downloaded the binary release of Fink, as I suggested in the previous Fink article, the second step can be skipped. Otherwise, run
fink configureand choose the option to use binary packages. This means typing
Ywhen asked "Should Fink try to download pre-compiled packages from the binary distribution if available? [Y/N]." Alternatively, you could place the line
UseBinaryDist: truein the configuration file /sw/etc/fink.conf (remember to open it with
sudo vimin Terminal.app).
- Add the location of the distribution server to the file /sw/etc/apt/sources.list. Assuming the IP address of the server is 192.168.0.1, run
sudo vim /sw/etc/apt/sources.listand add the following lines to the top of the file:
deb http://192.168.0.1/fink stable main crypto deb http://192.168.0.1/fink unstable main crypto deb http://192.168.0.1/fink local main
If you used FTP or SSH instead of HTTP, the protocol
http has to be changed appropiately in these lines.
fink selfupdate. If all goes well, the client discovers the server and you see some lines like this in the output:
Hit http://192.168.0.1 stable/main Packages
Now if you install or update a package on the client with the
apt-get command, Fink will first search to see if a binary of the package is available on the distribution server (because the added lines appear first in the file). If available, the package will be downloaded from the server. Otherwise, Fink will search on the local disk and the official binary distribution server. When no binary is found at all, Fink will download the source and compile it. As for the rest, don't forget to update the list of packages regularly with
fink selfupdate. Only then will clients discover new packages on the distribution server.
A Note About Dependencies
I already mentioned dependencies. Fink actually has a neat command to show you the dependencies of a package:
fink show-deps. As an example, you'll want to know on which packages irssi depends:
fink show-deps irssiInformation about 5134 packages read in 7 seconds. Package: irssi (0.8.9-25) To install the compiled package... The following other packages (and their dependencies) must be installed: glib2-shlibs libncurses5-shlibs ncurses perl581-core The following other packages must not be installed: irssi-ssl To compile this package from source... The following packages are also compiled at the same time: [none] The following other packages (and their dependencies) must be installed: fink (>= 0.13.0-1) glib2-dev glib2-shlibs libncurses5 libncurses5-shlibs ncurses perl581-core The following other packages must not be installed: [none]
As you see, after you type
fink show-deps irssi, Fink searches in its packages database for irssi. Then it shows two things: the list of packages you need to install the binary package, and the list of packages you need to compile the package. If you set up a binary distribution server and want to make sure the clients can download binaries of all needed packages from the server, you can search for the dependencies of all the packages you want to distribute and build them on the server. With a little bit of shell scripting knowledge, you can even create a script that generates a list of all needed packages from a list of wanted packages and install them on the server.
Creating a Source Package
You can create a source package for software that Fink doesn't have in its index, e.g. your own software. Let's see how you can do this. I want to create a source package for the gnuvd dictionary program. In its simplest form, it can look like this:
Package: gnuvd Version: 1.0.2 Revision: 1 Maintainer: Koen Vervloesem <firstname.lastname@example.org> HomePage: http://www.djcbsoftware.nl/code/gnuvd/ License: GPL Description: Dutch dictionary program that uses the Van Dale(tm) website # Unpack Phase Source: http://www.djcbsoftware.nl/code/gnuvd/gnuvd-%v.tar.gz Source-MD5: 1d2a28c25da8c1cb3cbd1aa60b28864c # Configure Phase ConfigureParams: --prefix=%i --mandir=%i/share/man --datadir=%i/share/doc/%n # Install Phase DocFiles: AUTHORS COPYING INSTALL README README.nl
The package states general information such as the name, version, description, maintainer, etc.
Revision is the version of the Fink package, not the original source. The first time you make a package for a specific program, you make the
Revision: 1, and you update it each time you make a new version of the package.
Lines beginning with
# are comments. I wrote comments to mark the unpack, configure, and install phases. In the
Source line, there's a
%v sign. This will be substituted by the version (1.0.2) of the software. If a new version of gnuvd comes out, I only have to change the version in the second line of the package file, if I use
%v in all other places in the file. The
Source-MD5 number can be computed with the
md5 command in Terminal.app. Just download the gnuvd-1.0.2.tar.gz file, go to the directory it's in, and type:
md5 gnuvd-1.0.2.tar.gzMD5 (gnuvd-1.0.2.tar.gz) = 1d2a28c25da8c1cb3cbd1aa60b28864c
Copy the value to the package file. Fink uses it to check that the file isn't tampered with or damaged when downloaded.