Once you have installed urpkg, you cannot install a program with it right
away. If you try, you will find that files can only be written where everybody
has write permission. Concretely, the package foo cannot be installed in
allowed
or in restricted
at the
moment. Let's make sure of this.
$
sudo urpkg --install install -v foo1 ../restricted/.
Should output something like this
Installing package foo-20080527... Preinstall script Running install command: install -v foo1 ../restricted/. install: cannot create regular file `../restricted/./foo1': Permission denied `foo1' -> `../allowed/./foo1' *** WARNING: The install command printed something to stderr (see /var/tmp/install.log): install: cannot create regular file `../restricted/./foo1': Permission denied *** ERROR *** urpkg: Command install with arguments '-v foo1 ../restricted/.' returned non-zero status 1 Cleaning up... Terminating all processes... Closing all files... Uninstalling uncompletely installed package. PLEASE DO NOT KILL Uninstalling package foo-20080527... Listing and removing files... Removing package user...
What happened was that our package user had no permission to write in
../restricted
, so the installation command failed and the
program was immediately uninstalled.
To allow programs to be installed in a directory, you need to change the directory's permissions.
Before doing that, you have to create two special groups. They are described in more details in the section called “Package user groups”
$
sudo groupadd urpkgrp-install$
sudo groupadd urpkgrp-shared
Now you can invoke the gen
command on the directories in
which you want to allow packages to be installed.
$
sudo urpkg --gen ../allowed
This allows any package user to write
in ../allowed
. However, existing files in these
directories cannot be overwritten or removed by anything else than the package
those files belong to. As an example
$
sudo urpkg --install install -v file2 ../allowed/file2
Will not work. You might simply want to
remove ../allowed/file2
and then retry, but what if the
installation script needs the content of file2
? For
example, file2
could be an index, and the installation
script might just want to append something to the index. The solution to this
is to change the permission of file2
to allow it to be
overwritten. It will still not be possible to remove it though. This is done
using the share
command.
$
sudo urpkg --share ../allowed/file2
Directories where one can install program are referred to
as installation directories while regular files that
package user can overwrite are called shared files. In a
real system, installation directories would for example
be /usr/bin/
or /etc
. Shared files
are rarer but can for example
include /usr/share/info/dir
, the index of all installed
info documentation files.
To make a shared file a normal file, or make an install directory a usual
directory, use respectively --unshare
and --ungen
. If you want to list your shared files,
use --list-shared
, --list-instdir
is used to
list installation directories.