Is it telling the OS that "from now on, when you install packages, whatever the package is(--local), if that package tries to install /sbin/initctl, install it(--add) to /sbin/initctl.distrib (--rename)"
--rename
tells it to move any existing file immediately
- I'd put
--add
next to "telling the OS"
Is it that if a file is diverted to another file by this dpkg-divert command(say, xfile to xfile.distrib) by a package, then when the package is used, xfile.distrib is used instead of original xfile?
No. Whoever set up the diversion has to provide something in place of this xfile
(in this case, that's you). In that page, they do:
ln -s /bin/true /sbin/initctl
The diversions
file consists of three-line groups:
- The file to be diverted
- The diverted location
- The package that set up the diversion
So for the following three lines:
/usr/share/dict/words
/usr/share/dict/words.pre-dictionaries-common
dictionaries-common
dpkg
will divert installations of /usr/share/dict/words
from packages other than dictionaries-common
(say, wamerican
, for example) to /usr/share/dict/words.pre-dictionaries-common
. If you install wamerican
, you can see this in action:
# dpkg -S /usr/share/dict/words
diversion by dictionaries-common from: /usr/share/dict/words
diversion by dictionaries-common to: /usr/share/dict/words.pre-dictionaries-common
wamerican: /usr/share/dict/words
That guide is a bit outdated: initctl
is Upstart, which is no longer used. You can't even install it anymore. Service management is done using systemd, and now you use systemctl
instead.