Playing with the program's files

You can also use --list with the package name as an argument to list all files belonging to a given package.

  $ urpkg --list foo

Notice that there is no need to give the package's full name. An unambiguous name is enough (e.g if there were two versions of foo installed, say foo-1.1 and foo-1.2, then we would have had to be more precise).

You should also see that there is only one file, foo1 that is listed. This is because file2 is a shared file. Now what if you want to add it to the package, so that it is removed if we uninstall foo ?

We first have to strip file2 of its status of shared file. Even though urpkg does not forbid shared files part of a package, it is a bad habit to take. Then we simply use the --add-files action.

  $ sudo urpkg --unshare ../allowed/file2
  $ sudo urpkg --add-files --change-owner --change-group foo ../allowed/file2

The --change-owner and --change-group deserve a more detailed explanation on what it exactly means to add a file to a package. This is presented in the section called “Owned and added files”. For the moment, it is enough to say that unless it is necessary for the file to keep its owner or group (e.g because it's a suid file), then those options should be used.

Another option since version 1.4 is to use the urpkgize script. This script adds a bunch of files to a given package, trying to figure out the correct options for each file on the way. For example, to perform the same action as before you would do:

  $ sudo urpkgize foo ../allowed/file2

In general, you should use --add-files, and take care of the options yourself. urpkgize only comes in handy when you want to add a lot of files to a package. You can find more information on urpkgize in urpkgize(1).

Now let's check that the file has correctly been added

  $ urpkg --list foo

What if you don't want foo1 to be part of the package anymore ? In that case, you should do

  $ sudo urpkg --free-files --change-owner=OWNER --change-group=GROUP foo ../allowed/foo1

You should replace OWNER and GROUP by the owner and group you want the file to have. If those options are not specified, they will both be set to root.

What if you don't remember which package(s) the file file2 belongs to ? Then you can use --find

  $ urpkg --find ../allowed/file2