update-alternatives.8 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  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 " and " vim .
  237. Which one is used is controlled by the link group
  238. .BR vi ,
  239. which includes links for the program itself and the associated manpage.
  240. .PP
  241. To display the available packages which provide
  242. .B vi
  243. and the current setting for it, use the
  244. .I --display
  245. action:
  246. .RS
  247. .PP
  248. update-alternatives --display vi
  249. .RE
  250. .PP
  251. To choose a particular
  252. .B vi
  253. implementation, use this command as root and then select a number
  254. from the list:
  255. .RS
  256. .PP
  257. update-alternatives --config vi
  258. .RE
  259. .PP
  260. To go back to having the
  261. .B vi
  262. implementation chosen automatically, do this as root:
  263. .RS
  264. .PP
  265. update-alternatives --auto vi
  266. .RE
  267. .SH OPTIONS
  268. Exactly one action must be specified if
  269. .B update-alternatives
  270. is to perform any meaningful task.
  271. Any number of the common options may be specified together with any action.
  272. .SS "COMMON OPTIONS"
  273. .TP
  274. .B --verbose
  275. Generate more comments about what
  276. .B update-alternatives
  277. is doing.
  278. .TP
  279. .B --quiet
  280. Don't generate any comments unless errors occur.
  281. This option is not yet implemented.
  282. .TP
  283. .B --test
  284. Don't actually do anything, just say what would be done.
  285. This option is not yet implemented.
  286. .TP
  287. .B --help
  288. Give some usage information (and say which version of
  289. .B update-alternatives
  290. this is).
  291. .TP
  292. .B --version
  293. Tell which version of
  294. .B update-alternatives
  295. this is (and give some usage information).
  296. .TP
  297. \fB--altdir\fR \fIdirectory\fR
  298. Specifies the alternatives directory, when this is to be
  299. different from the default.
  300. .TP
  301. \fB--admindir\fR \fIdirectory\fR
  302. Specifies the administrative directory, when this is to be
  303. different from the default.
  304. .SS ACTIONS
  305. .\" The names of the arguments should be identical with the ones
  306. .\" in SYNOPSIS section.
  307. .TP
  308. \fB--install\fR \fIlink gen path pri\fR [\fB--slave\fR \fIslink sgen spath\fR] ...
  309. Add a group of alternatives to the system.
  310. .I gen
  311. is the generic name for the master link,
  312. .I link
  313. is the name of its symlink, and
  314. .I path
  315. is the alternative being introduced for the master link.
  316. .IR sgen ,
  317. .I slink
  318. and
  319. .I spath
  320. are the generic name, symlink name and alternative
  321. for a slave link.
  322. Zero or more
  323. .B --slave
  324. options, each followed by three arguments,
  325. may be specified.
  326. .IP
  327. If the master symlink specified exists already
  328. in the alternatives system's records,
  329. the information supplied will be added as a new
  330. set of alternatives for the group.
  331. Otherwise, a new group, set to automatic mode,
  332. will be added with this information.
  333. If the group is in automatic mode,
  334. and the newly added alternatives' priority is higher than
  335. any other installed alternatives for this group,
  336. the symlinks will be updated to point to the newly added alternatives.
  337. .TP
  338. \fB--set\fR \fIname path\fR
  339. Set the program
  340. .I path
  341. as alternative for
  342. .I name.
  343. This is equivalent to
  344. .IB --config
  345. but is non-interactive and thus scriptable.
  346. .TP
  347. \fB--remove\fR \fIname path\fR
  348. Remove an alternative and all of its associated slave links.
  349. .I name
  350. is a name in the alternatives directory, and
  351. .I path
  352. is an absolute filename to which
  353. .I name
  354. could be linked. If
  355. .I name
  356. is indeed linked to
  357. .IR path ,
  358. .I name
  359. will be updated to point to another appropriate alternative, or
  360. removed if there is no such alternative left.
  361. Associated slave links will be updated or removed, correspondingly.
  362. If the link is not currently pointing to
  363. .IR path ,
  364. no links are changed;
  365. only the information about the alternative is removed.
  366. .TP
  367. \fB--remove-all\fR \fIname\fR
  368. Remove all alternatives and all of their associated slave links.
  369. .I name
  370. is a name in the alternatives directory.
  371. .TP
  372. .B --all
  373. Call \fB--config\fP on all alternatives.
  374. .TP
  375. \fB--auto\fR \fIlink\fR
  376. Switch the master symlink
  377. .I link
  378. to automatic mode.
  379. In the process, this symlink and its slaves are updated
  380. to point to the highest priority installed alternatives.
  381. .TP
  382. \fB--display\fR \fIlink\fR
  383. Display information about the link group of which
  384. .I link
  385. is the master link.
  386. Information displayed includes the group's mode
  387. (auto or manual),
  388. which alternative the symlink currently points to,
  389. what other alternatives are available
  390. (and their corresponding slave alternatives),
  391. and the highest priority alternative currently installed.
  392. .TP
  393. \fB--list\fR \fIlink\fR
  394. Display all targets of the link group.
  395. .TP
  396. \fB--config\fR \fIlink\fR
  397. Show available alternatives for a link group and allow the user to
  398. interactively select which one to use. The link group is updated
  399. and taken out of
  400. .I auto
  401. mode.
  402. .SH FILES
  403. .TP
  404. .I /etc/alternatives/
  405. The default alternatives directory.
  406. Can be overridden by the
  407. .B --altdir
  408. option.
  409. .TP
  410. .I /var/lib/dpkg/alternatives/
  411. The default administration directory.
  412. Can be overridden by the
  413. .B --admindir
  414. option.
  415. .SH "EXIT STATUS"
  416. .IP 0
  417. The requested action was successfully performed.
  418. .IP 2
  419. Problems were encountered whilst parsing the command line
  420. or performing the action.
  421. .SH DIAGNOSTICS
  422. .B update-alternatives
  423. chatters incessantly about its activities on its standard output channel.
  424. If problems occur,
  425. .B update-alternatives
  426. outputs error messages on its standard error channel and
  427. returns an exit status of 2.
  428. These diagnostics should be self-explanatory;
  429. if you do not find them so, please report this as a bug.
  430. .SH BUGS
  431. If you find a bug, please report it using the Debian bug-tracking system,
  432. or, if that is not possible, email the author directly.
  433. .PP
  434. If you find any discrepancy between the operation of
  435. .B update-alternatives
  436. and this manual page, it is a bug,
  437. either in the implementation or the documentation; please report it.
  438. .SH AUTHOR
  439. Debian update-alternatives is copyright 1995
  440. Ian Jackson. It is free software; see the GNU General Public Licence
  441. version 2 or later for copying conditions. There is NO warranty.
  442. .PP
  443. This manual page is copyright 1997/98 Charles Briscoe-Smith.
  444. This is free documentation; see the GNU General Public Licence
  445. version 2 or later for copying conditions. There is NO WARRANTY.
  446. .PP
  447. You can find the GNU GPL in /usr/share/common-licenses/GPL on any Debian system.
  448. .SH "SEE ALSO"
  449. .BR ln (1),
  450. FHS, the Filesystem Hierarchy Standard.