update-alternatives.8 12 KB

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