Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 144332
Collapse All | Expand All

(-)ebuild-writing/variables/text.xml (-1 / +44 lines)
Lines 93-99 Link Here
93
    <ti><c>ROOT</c></ti>
93
    <ti><c>ROOT</c></ti>
94
    <ti>
94
    <ti>
95
      Path to the root directory. When not using <c>${D}</c>,
95
      Path to the root directory. When not using <c>${D}</c>,
96
      always prepend <c>${ROOT}</c> to the path.
96
      always prepend <c>${ROOT}</c> to the path, see
97
      <uri link="::ebuild-writing/variables#ROOT"/>.
97
    </ti>
98
    </ti>
98
  </tr>
99
  </tr>
99
  <tr>
100
  <tr>
Lines 351-356 Link Here
351
</section>
352
</section>
352
353
353
<section>
354
<section>
355
<title>ROOT</title>
356
<body>
357
358
<p>
359
The idea behind <c>ROOT</c> is that one can build a system with 
360
<c>ROOT=/somewhere</c> and then chroot into it or tar up <c>/somewhere</c>
361
as a system image. It is not designed to allow the user to run 
362
<c>/somewhere/usr/bin/foo</c>.
363
</p>
364
365
<p>
366
An ebuild could use <c>ROOT</c> in <c>pkg_postinst()</c> to conditionally print
367
an error message if an old and obsolete configuration file still exists.
368
369
<codesample lang="ebuild">
370
pkg_postinst() {
371
	if [ -e "${ROOT}/etc/oldconfig" ]; then
372
		ewarn "You still have the obsolete config file "
373
		ewarn "    ${ROOT}/etc/oldconfig."
374
		ewarn "Please migrate your settings to ${ROOT}/etc/newconfig"
375
		ewarn "and remove ${ROOT}/etc/oldconfig."
376
	fi
377
}
378
</codesample>
379
</p>
380
381
<p>
382
<c>ROOT</c> can't be used correctly in <c>src_*</c>, since <c>ROOT</c> might be 
383
different when merging a binary package. For example, a binary package might be
384
built with <c>ROOT=/</c> and then installed onto a system using 
385
<c>ROOT=/somewhere</c>.
386
</p>
387
388
<p>
389
<c>ROOT</c> isn't used for library dependencies. When building, libraries, 
390
headers etc. on <c>/</c> have to be used.
391
</p>
392
393
</body>
394
</section>
395
396
<section>
354
<title>Version Formatting Issues</title>
397
<title>Version Formatting Issues</title>
355
<body>
398
<body>
356
399

Return to bug 144332