update-alternatives.8 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. .\" update\-alternatives.8
  2. .\" This man page is copyright 1997 Charles Briscoe-Smith
  3. .\" This is free documentation; you can redistribute it and/or modify
  4. .\" it under the terms of the GNU General Public License as published
  5. .\" by the Free Software Foundation; either version 2 of the License, or
  6. .\" (at your option) any later version. There is NO WARRANTY. You can
  7. .\" find the GNU GPL in /usr/share/common-licenses/GPL on any Debian system.
  8. .TH update\-alternatives 8 "2007-03-06" "Debian Project" "dpkg utilities"
  9. .SH NAME
  10. update\-alternatives - maintain symbolic links determining default commands
  11. .
  12. .SH SYNOPSIS
  13. .B update\-alternatives
  14. .RI [ options ]
  15. .I command
  16. .
  17. .SH DESCRIPTION
  18. .B update\-alternatives
  19. creates, removes, maintains and displays information about the symbolic
  20. links comprising the Debian alternatives system.
  21. .PP
  22. It is possible for several programs fulfilling the same or similar
  23. functions to be installed on a single system at the same time.
  24. For example, many systems have several text editors installed at once.
  25. This gives choice to the users of a system, allowing each to use a
  26. different editor, if desired, but makes it difficult for a program
  27. to make a good choice for an editor to invoke if the
  28. user has not specified a particular preference.
  29. .PP
  30. Debian's alternatives system aims to solve this problem.
  31. A generic name in the filesystem is
  32. shared by all files providing interchangeable functionality.
  33. The alternatives system and the system administrator
  34. together determine which actual file is referenced by this generic name.
  35. For example, if the text editors
  36. .BR ed (1)
  37. and
  38. .BR nvi (1)
  39. are both installed on the system, the alternatives system will cause
  40. the generic name
  41. .I /usr/bin/editor
  42. to refer to
  43. .I /usr/bin/nvi
  44. by default. The system administrator can override this and cause
  45. it
  46. to refer to
  47. .I /usr/bin/ed
  48. instead,
  49. and the alternatives system will not alter this setting until explicitly
  50. requested to do so.
  51. .PP
  52. The generic name is not a direct symbolic link to the selected alternative.
  53. Instead, it is a symbolic link to a name in the
  54. .I alternatives
  55. .IR directory ,
  56. which in turn is a symbolic link to the actual file referenced.
  57. This is done so that the system administrator's changes can be confined
  58. within the
  59. .I /etc
  60. directory: the FHS (q.v.) gives reasons why this is a Good Thing.
  61. .PP
  62. When each package
  63. providing a file with a particular functionality is
  64. installed, changed or removed,
  65. .B update\-alternatives
  66. is called to update information about that file in the alternatives system.
  67. .B update\-alternatives
  68. is usually called from the
  69. .B postinst
  70. or
  71. .B prerm
  72. scripts in Debian packages.
  73. .PP
  74. It is often useful for a number of alternatives to be synchronised,
  75. so that they are changed as a group; for example, when several versions
  76. of the
  77. .BR vi (1)
  78. editor are installed, the man page referenced by
  79. .I /usr/share/man/man1/vi.1
  80. should correspond to the executable referenced by
  81. .IR /usr/bin/vi .
  82. .B update\-alternatives
  83. handles this by means of
  84. .I master
  85. and
  86. .I slave
  87. links; when the master is changed, any associated slaves are changed
  88. too.
  89. A master link and its associated slaves make up a
  90. .I link
  91. .IR group .
  92. .PP
  93. Each link group is, at any given time,
  94. in one of two modes: automatic or manual.
  95. When a group is in automatic mode, the alternatives system will
  96. automatically decide, as packages are installed and removed,
  97. whether and how to update the links.
  98. In manual mode, the alternatives system will not change the links;
  99. it will leave all the decisions to the system administrator.
  100. .PP
  101. Link groups are in automatic mode when they are first introduced to
  102. the system.
  103. If the system administrator makes changes to the system's
  104. automatic settings,
  105. this will be noticed the next time
  106. .B update\-alternatives
  107. is run on the changed link's group,
  108. and the group will automatically be switched to manual mode.
  109. .PP
  110. Each alternative has a
  111. .I priority
  112. associated with it.
  113. When a link group is in automatic mode,
  114. the alternatives pointed to by members of the group
  115. will be those which have the highest priority.
  116. .PP
  117. When using the
  118. .I \-\-config
  119. option,
  120. .B update\-alternatives
  121. will list all of the choices for the link group
  122. of which given
  123. .I name
  124. is the master link. The current choice is marked with a '*' and the
  125. choice with the highest priority with a '+'.
  126. You will then be prompted for your choice regarding this link group.
  127. Once you make a change, the link group will no longer be in
  128. .I auto
  129. mode. You will need to use the
  130. .I \-\-auto
  131. option in order to return to the automatic mode.
  132. .PP
  133. If you want to configure non-interactively you can use the
  134. .I \-\-set
  135. option instead (see below).
  136. .PP
  137. Different packages providing the same file need to do so
  138. .BR cooperatively .
  139. That is - the usage of
  140. .B update\-alternatives
  141. is
  142. .B mandatory
  143. for all involved packages in such case - it is not possible to
  144. override some file in a package that does not employ the
  145. .B update\-alternatives
  146. mechanism.
  147. .
  148. .SH TERMINOLOGY
  149. Since the activities of
  150. .B update\-alternatives
  151. are quite involved, some specific terms will help to explain its
  152. operation.
  153. .TP
  154. generic name
  155. A name, like
  156. .IR /usr/bin/editor ,
  157. which refers, via the alternatives system, to one of a number of
  158. files of similar function.
  159. .TP
  160. symlink
  161. Without any further qualification, this means a symbolic link in the
  162. alternatives directory: one which the system administrator is expected
  163. to adjust.
  164. .TP
  165. alternative
  166. The name of a specific file in the filesystem, which may be made
  167. accessible via a generic name using the alternatives system.
  168. .TP
  169. alternatives directory
  170. A directory, by default
  171. .IR /etc/alternatives ,
  172. containing the symlinks.
  173. .TP
  174. administrative directory
  175. A directory, by default
  176. .IR /var/lib/dpkg/alternatives ,
  177. containing
  178. .BR update\-alternatives '
  179. state information.
  180. .TP
  181. link group
  182. A set of related symlinks, intended to be updated as a group.
  183. .TP
  184. master link
  185. The link in a link group which determines how the other links in the
  186. group are configured.
  187. .TP
  188. slave link
  189. A link in a link group which is controlled by the setting of
  190. the master link.
  191. .TP
  192. automatic mode
  193. When a link group is in automatic mode,
  194. the alternatives system ensures that the links in the group
  195. point to the highest priority alternative
  196. appropriate for the group.
  197. .TP
  198. manual mode
  199. When a link group is in manual mode,
  200. the alternatives system will not make any changes
  201. to the system administrator's settings.
  202. .
  203. .SH COMMANDS
  204. .TP
  205. \fB\-\-install\fR \fIgenname symlink altern priority\fR [\fB\-\-slave\fR \fIgenname symlink altern\fR] ...
  206. Add a group of alternatives to the system.
  207. .I genname
  208. is the generic name for the master link,
  209. .I symlink
  210. is the name of its symlink in the alternatives directory, and
  211. .I altern
  212. is the alternative being introduced for the master link.
  213. The arguments after \fB\-\-slave\fR are the generic name, symlink name in the
  214. alternatives directory and the alternative for a slave link.
  215. Zero or more
  216. .B \-\-slave
  217. options, each followed by three arguments,
  218. may be specified.
  219. .IP
  220. If the master symlink specified exists already
  221. in the alternatives system's records,
  222. the information supplied will be added as a new
  223. set of alternatives for the group.
  224. Otherwise, a new group, set to automatic mode,
  225. will be added with this information.
  226. If the group is in automatic mode,
  227. and the newly added alternatives' priority is higher than
  228. any other installed alternatives for this group,
  229. the symlinks will be updated to point to the newly added alternatives.
  230. .TP
  231. \fB\-\-set\fR \fIname path\fR
  232. Set the program
  233. .I path
  234. as alternative for
  235. .I name.
  236. This is equivalent to
  237. .IB \-\-config
  238. but is non-interactive and thus scriptable.
  239. .TP
  240. \fB\-\-remove\fR \fIname path\fR
  241. Remove an alternative and all of its associated slave links.
  242. .I name
  243. is a name in the alternatives directory, and
  244. .I path
  245. is an absolute filename to which
  246. .I name
  247. could be linked. If
  248. .I name
  249. is indeed linked to
  250. .IR path ,
  251. .I name
  252. will be updated to point to another appropriate alternative, or
  253. removed if there is no such alternative left.
  254. Associated slave links will be updated or removed, correspondingly.
  255. If the link is not currently pointing to
  256. .IR path ,
  257. no links are changed;
  258. only the information about the alternative is removed.
  259. .TP
  260. \fB\-\-remove\-all\fR \fIname\fR
  261. Remove all alternatives and all of their associated slave links.
  262. .I name
  263. is a name in the alternatives directory.
  264. .TP
  265. .B \-\-all
  266. Call \fB\-\-config\fP on all alternatives.
  267. .TP
  268. \fB\-\-auto\fR \fIlink\fR
  269. Switch the master symlink
  270. .I link
  271. to automatic mode.
  272. In the process, this symlink and its slaves are updated
  273. to point to the highest priority installed alternatives.
  274. .TP
  275. \fB\-\-display\fR \fIlink\fR
  276. Display information about the link group of which
  277. .I link
  278. is the master link.
  279. Information displayed includes the group's mode
  280. (auto or manual),
  281. which alternative the symlink currently points to,
  282. what other alternatives are available
  283. (and their corresponding slave alternatives),
  284. and the highest priority alternative currently installed.
  285. .TP
  286. \fB\-\-list\fR \fIlink\fR
  287. Display all targets of the link group.
  288. .TP
  289. \fB\-\-config\fR \fIlink\fR
  290. Show available alternatives for a link group and allow the user to
  291. interactively select which one to use. The link group is updated
  292. and taken out of
  293. .I auto
  294. mode.
  295. .TP
  296. .B \-\-help
  297. Show the usage message and exit.
  298. .TP
  299. .B \-\-version
  300. Show the version and exit.
  301. .
  302. .SH OPTIONS
  303. .TP
  304. .BI \-\-altdir " directory"
  305. Specifies the alternatives directory, when this is to be
  306. different from the default.
  307. .TP
  308. .BI \-\-admindir " directory"
  309. Specifies the administrative directory, when this is to be
  310. different from the default.
  311. .TP
  312. .B \-\-verbose
  313. Generate more comments about what
  314. .B update\-alternatives
  315. is doing.
  316. .TP
  317. .B \-\-quiet
  318. Don't generate any comments unless errors occur.
  319. This option is not yet implemented.
  320. .TP
  321. .B \-\-test
  322. Don't actually do anything, just say what would be done.
  323. This option is not yet implemented.
  324. .
  325. .SH FILES
  326. .TP
  327. .I /etc/alternatives/
  328. The default alternatives directory.
  329. Can be overridden by the
  330. .B \-\-altdir
  331. option.
  332. .TP
  333. .I /var/lib/dpkg/alternatives/
  334. The default administration directory.
  335. Can be overridden by the
  336. .B \-\-admindir
  337. option.
  338. .
  339. .SH "EXIT STATUS"
  340. .IP 0
  341. The requested action was successfully performed.
  342. .IP 2
  343. Problems were encountered whilst parsing the command line
  344. or performing the action.
  345. .
  346. .SH DIAGNOSTICS
  347. .B update\-alternatives
  348. chatters incessantly about its activities on its standard output channel.
  349. If problems occur,
  350. .B update\-alternatives
  351. outputs error messages on its standard error channel and
  352. returns an exit status of 2.
  353. These diagnostics should be self-explanatory;
  354. if you do not find them so, please report this as a bug.
  355. .
  356. .SH EXAMPLES
  357. There are several packages which provide a text editor compatible
  358. with \fBvi\fP, for example \fBnvi\fP and \fBvim\fP. Which one is used
  359. is controlled by the link group \fBvi\fP, which includes links for the
  360. program itself and the associated manpage.
  361. .PP
  362. To display the available packages which provide \fBvi\fP and the current
  363. setting for it, use the \fI\-\-display\fP action:
  364. .RS
  365. .PP
  366. .B update\-alternatives \-\-display vi
  367. .RE
  368. .PP
  369. To choose a particular \fBvi\fP implementation, use this command as root
  370. and then select a number from the list:
  371. .RS
  372. .PP
  373. .B update\-alternatives \-\-config vi
  374. .RE
  375. .PP
  376. To go back to having the \fBvi\fP implementation chosen automatically, do
  377. this as root:
  378. .RS
  379. .PP
  380. .B update\-alternatives \-\-auto vi
  381. .RE
  382. .
  383. .SH BUGS
  384. If you find a bug, please report it using the Debian bug-tracking system,
  385. or, if that is not possible, email the author directly.
  386. .PP
  387. If you find any discrepancy between the operation of
  388. .B update\-alternatives
  389. and this manual page, it is a bug,
  390. either in the implementation or the documentation; please report it.
  391. .
  392. .SH AUTHOR
  393. Debian update\-alternatives is copyright 1995
  394. Ian Jackson. It is free software; see the GNU General Public Licence
  395. version 2 or later for copying conditions. There is NO warranty.
  396. .PP
  397. This manual page is copyright 1997/98 Charles Briscoe-Smith.
  398. This is free documentation; see the GNU General Public Licence
  399. version 2 or later for copying conditions. There is NO WARRANTY.
  400. .PP
  401. You can find the GNU GPL in /usr/share/common\-licenses/GPL on any Debian system.
  402. .
  403. .SH "SEE ALSO"
  404. .BR ln (1),
  405. FHS, the Filesystem Hierarchy Standard.