There is an importance distinction to make between a package name and a package user. As already mentioned, urpkg creates a new user for each program (urpkg calls them package) you install. The files that are then created all have the new user as owner and can therefore easily be found.
However, urpkg first has to come up with a name for this user. The name should conform to the syntax of a username (e.g, no dot in the name) and should not be the same as other users in the system. One could simply come up with a unique number as username, however that would be really confusing and not really helpful e.g to someone listing a file belonging to that package.
The solution that urpkg uses is the following. We ask the user for, or
guess, a package name that is basically the name of the
program we are installing. This name can syntactically be anything the user
wants. Then, from that name we generate a package user
name. The package name is kept in the comment field of the user
name in /etc/passwd
.
The package user name always begins with “urpkg-”. This is a prefix to avoid that the name collides with another user of the system. Urpkg then generates the rest of the username using the beginning of the package name, and adding some numbers if necessary. You should look at the source if you want more details on the exact algorithm which is used. Special characters in the package name are replaced by “_”. For example, from a package name “emacs-22”, the package user could be “urpkg-emacs-22”. You shouldn't rely on this, however, as the algorithm used by urpkg to generate user names can change at any release without notice !
Note that package names (and package users) are always all in lowercase letters. Even if you give your name explicitly, the case does not matter and your name will automatically be converted to lowercase. For example, running
$
urpkg --install --pkg-name=Emacs-22 make install
Will still create a package name “emacs-22” and a package user “urpkg-emacs-22”.
In general, you don't have to worry about package users, but it's good to know about them, as you can still see them mentioned from time to time. For example, assuming you really have emacs installed as a package named emacs-22, doing
$
ls -l $(which emacs)
-rwxr-xr-t 2 urpkg-emacs-22 urpkg-emacs-22 13576490 2008-03-21 17:59 /usr/bin/emacs
will really give you the package user name of the package the
file /usr/bin/emacs
belongs to.
As you learned in the previous chapter, you can specify a package name
explicitly using --pkg-name
. Urpkg can also guess a
package name for you from the current directory. Now how does it do it ?
Urpkg will simply take the basename of your current directory (i.e if your
current directory is /var/tmp/emacs-22.1
, the basename
is emacs-22.1
). It will then check if it has a version
string. A version string is defined as anything following a dash
(-
). In our example, there is a version string so the package
name would be “emacs-22.1”. If there is no version string,
urpkg will append one with the date in the following
format: YYYYmmdd
. For example, if you are developing your own
program, foo which is in a directory /var/tmp/foo
, then
if you install it on June, 30th 2010 the package name will
be “foo-20100630”.
Of course, there cannot be two package with the same name installed on the system, so urpkg will signal an error if you try to give a package name which is already the name of an existing package.