| 1 |
# Copyright 1999-2006 Gentoo Foundation
|
| 2 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
# $Header: /var/cvsroot/gentoo-x86/sys-apps/baselayout/baselayout-1.12.0_pre15-r1.ebuild,v 1.1 2006/01/24 22:16:37 uberlord Exp $
|
| 4 |
|
| 5 |
inherit flag-o-matic eutils toolchain-funcs multilib
|
| 6 |
|
| 7 |
DESCRIPTION="Filesystem baselayout and init scripts"
|
| 8 |
HOMEPAGE="http://www.gentoo.org/"
|
| 9 |
SRC_URI="mirror://gentoo/${P}.tar.bz2
|
| 10 |
http://dev.gentoo.org/~uberlord/baselayout/${P}.tar.bz2
|
| 11 |
http://dev.gentoo.org/~azarah/baselayout/${P}.tar.bz2
|
| 12 |
http://dev.gentoo.org/~vapier/dist/${P}.tar.bz2"
|
| 13 |
|
| 14 |
LICENSE="GPL-2"
|
| 15 |
SLOT="0"
|
| 16 |
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
|
| 17 |
IUSE="bootstrap build static unicode"
|
| 18 |
|
| 19 |
# This version of baselayout needs gawk in /bin, but as we do not have
|
| 20 |
# a c++ compiler during bootstrap, we cannot depend on it if "bootstrap"
|
| 21 |
# or "build" are in USE.
|
| 22 |
RDEPEND="userland_GNU? (
|
| 23 |
>=sys-apps/sysvinit-2.86-r3
|
| 24 |
!build? ( !bootstrap? (
|
| 25 |
>=sys-apps/coreutils-5.2.1
|
| 26 |
) )
|
| 27 |
)
|
| 28 |
!build? ( !bootstrap? (
|
| 29 |
>=sys-libs/readline-5.0-r1
|
| 30 |
>=app-shells/bash-3.0-r10
|
| 31 |
) )"
|
| 32 |
DEPEND="virtual/os-headers
|
| 33 |
>=sys-apps/portage-2.0.51"
|
| 34 |
PROVIDE="virtual/baselayout"
|
| 35 |
|
| 36 |
src_unpack() {
|
| 37 |
unpack ${A}
|
| 38 |
cd "${S}"
|
| 39 |
|
| 40 |
# Bring release upto svn 1839, fixing #117912 and #120154.
|
| 41 |
epatch "${FILESDIR}/${P}-1839.patch"
|
| 42 |
|
| 43 |
# Setup unicode defaults for silly unicode users
|
| 44 |
if use unicode ; then
|
| 45 |
sed -i -e '/^UNICODE=/s:no:yes:' etc/rc.conf
|
| 46 |
fi
|
| 47 |
|
| 48 |
# Tweak arch-specific details
|
| 49 |
cd "${S}"
|
| 50 |
|
| 51 |
case $(tc-arch) in
|
| 52 |
sparc)
|
| 53 |
sed -i -e '/^KEYMAP=/s:us:sunkeymap:' etc/conf.d/keymaps || die
|
| 54 |
# Disable interactive boot on sparc due to stty calls, #104067
|
| 55 |
sed -i -e '/^RC_INTERACTIVE=/s:yes:no:' etc/conf.d/rc || die
|
| 56 |
;;
|
| 57 |
esac
|
| 58 |
|
| 59 |
# Use correct path to filefuncs.so on multilib systems
|
| 60 |
sed -i -e "s:/lib/rcscripts:/$(get_libdir)/rcscripts:" \
|
| 61 |
${S}/src/awk/{cachedepends,genenviron}.awk || die
|
| 62 |
|
| 63 |
# START FLAMEEYES'S DIRTY HACK
|
| 64 |
# This is here just because this is an experiment, when the changes to this
|
| 65 |
# ebuild will go in, it will also mean that the released tarball will be
|
| 66 |
# already split out...
|
| 67 |
mkdir -p "${S}"/platform/{linux,gnu,freebsd}/{etc,man,init.d,sbin}
|
| 68 |
|
| 69 |
mv "${S}"/etc/{modules.autoload.d,modules.d,sysctl.conf,filesystems,fstab} \
|
| 70 |
"${S}"/platform/linux/etc
|
| 71 |
mv "${S}"/etc/{passwd,group,shadow,networks} "${S}"/platform/gnu/etc
|
| 72 |
|
| 73 |
mv "${S}"/man/{MAKEDEV.8,modules.autoload.5,modules-update.8} "${S}"/platform/linux/man
|
| 74 |
|
| 75 |
mv "${S}"/init.d/* "${S}"/platform/linux/init.d
|
| 76 |
|
| 77 |
mv "${S}"/sbin/{MAKEDEV,modules-update} "${S}"/platform/linux/sbin
|
| 78 |
# END FLAMEEYES'S DIRTY HACK
|
| 79 |
|
| 80 |
# This copies the platform-dependent files inside the main sources, so that
|
| 81 |
# it can be accessed directly
|
| 82 |
case "${CHOST}" in
|
| 83 |
*-freebsd*)
|
| 84 |
cp -r "${S}"/platform/freebsd/* "${S}"
|
| 85 |
;;
|
| 86 |
# Consider the default fallback linux
|
| 87 |
*)
|
| 88 |
cp -r "${S}"/platform/linux/* "${S}"
|
| 89 |
cp -r "${S}"/platform/gnu/* "${S}"
|
| 90 |
esac
|
| 91 |
}
|
| 92 |
|
| 93 |
src_compile() {
|
| 94 |
local libdir="lib"
|
| 95 |
|
| 96 |
use static && append-ldflags -static
|
| 97 |
|
| 98 |
[[ ${SYMLINK_LIB} == "yes" ]] && libdir=$(get_abi_LIBDIR "${DEFAULT_ABI}")
|
| 99 |
|
| 100 |
case "${CHOST}" in
|
| 101 |
*-freebsd*|*-dragonfly*|*-netbsd*|*-openbsd*)
|
| 102 |
OS="BSD" ;;
|
| 103 |
*)
|
| 104 |
OS="Linux" ;;
|
| 105 |
esac
|
| 106 |
|
| 107 |
make -C "${S}"/src \
|
| 108 |
CC="$(tc-getCC)" \
|
| 109 |
LD="$(tc-getCC) ${LDFLAGS}" \
|
| 110 |
CFLAGS="${CFLAGS}" \
|
| 111 |
OS="${OS}" \
|
| 112 |
LIBDIR="${libdir}" || die
|
| 113 |
}
|
| 114 |
|
| 115 |
# ${PATH} should include where to get MAKEDEV when calling this
|
| 116 |
# function
|
| 117 |
create_dev_nodes() {
|
| 118 |
case $(tc-arch) in
|
| 119 |
# amd64 must use generic-i386 because amd64/x86_64 does not have
|
| 120 |
# a generic option at this time, and the default 'generic' ends
|
| 121 |
# up erroring out, because MAKEDEV internally doesn't know what
|
| 122 |
# to use
|
| 123 |
arm) suffix=-arm ;;
|
| 124 |
alpha) suffix=-alpha ;;
|
| 125 |
amd64) suffix=-i386 ;;
|
| 126 |
hppa) suffix=-hppa ;;
|
| 127 |
ia64) suffix=-ia64 ;;
|
| 128 |
m68k) suffix=-m68k ;;
|
| 129 |
mips) suffix=-mips ;;
|
| 130 |
ppc*) suffix=-powerpc ;;
|
| 131 |
s390) suffix=-s390 ;;
|
| 132 |
sparc*) suffix=-sparc ;;
|
| 133 |
x86) suffix=-i386 ;;
|
| 134 |
esac
|
| 135 |
|
| 136 |
einfo "Using generic${suffix} to make $(tc-arch) device nodes..."
|
| 137 |
MAKEDEV generic${suffix}
|
| 138 |
MAKEDEV sg scd rtc hde hdf hdg hdh input audio video
|
| 139 |
}
|
| 140 |
|
| 141 |
# This is a temporary workaround until bug 9849 is completely solved
|
| 142 |
# in portage. We need to create the directories so they're available
|
| 143 |
# during src_install, but when src_install is finished, call unkdir
|
| 144 |
# to remove any empty directories instead of leaving them around.
|
| 145 |
kdir() {
|
| 146 |
typeset -a args
|
| 147 |
typeset d
|
| 148 |
|
| 149 |
# Create the directories for the remainder of src_install, and
|
| 150 |
# remember how to create the directories later.
|
| 151 |
for d in "$@"; do
|
| 152 |
if [[ $d == /* ]]; then
|
| 153 |
install -d "${args[@]}" "${D}/${d}"
|
| 154 |
cat >> "${D}/usr/share/baselayout/mkdirs.sh" <<EOF
|
| 155 |
if [ ! -d "\${ROOT}/${d}" ] ; then \\
|
| 156 |
install -d ${args[@]} "\${ROOT}/${d}" 2>/dev/null \\
|
| 157 |
|| ewarn " can't create ${d}"
|
| 158 |
touch "\${ROOT}/${d}/.keep" 2>/dev/null \\
|
| 159 |
|| ewarn " can't create ${d}/.keep"
|
| 160 |
fi
|
| 161 |
EOF
|
| 162 |
else
|
| 163 |
args=("${args[@]}" "${d}")
|
| 164 |
fi
|
| 165 |
done
|
| 166 |
}
|
| 167 |
|
| 168 |
# Continued from kdir above... This function removes any empty
|
| 169 |
# directories as a temporary workaround for bug 9849. The directories
|
| 170 |
# (and .keep files) are re-created in pkg_postinst, which means they
|
| 171 |
# aren't listed in CONTENTS, unfortunately.
|
| 172 |
unkdir() {
|
| 173 |
einfo "Running unkdir to workaround bug 9849"
|
| 174 |
find "${D}" -depth -type d -exec rmdir {} \; 2>/dev/null
|
| 175 |
if [[ $? == 127 ]]; then
|
| 176 |
ewarn "Problem running unkdir: find command not found"
|
| 177 |
fi
|
| 178 |
}
|
| 179 |
|
| 180 |
# Same as kdir above, but for symlinks #103618
|
| 181 |
ksym() {
|
| 182 |
echo "[[ ! -e ${ROOT}/$2 ]] && { ln -s '$1' '${ROOT}/$2' &> /dev/null || ewarn ' unable to symlink $2 to $1' ; }" \
|
| 183 |
>> "${D}"/usr/share/baselayout/mklinks.sh
|
| 184 |
}
|
| 185 |
|
| 186 |
src_install() {
|
| 187 |
local dir libdirs libdirs_env rcscripts_dir
|
| 188 |
|
| 189 |
# This directory is to stash away things that will be used in
|
| 190 |
# pkg_postinst; it's needed first for kdir to function
|
| 191 |
dodir /usr/share/baselayout
|
| 192 |
|
| 193 |
# Jeremy Huddleston <eradicator@gentoo.org>
|
| 194 |
# For multilib, we want to make sure that all our multilibdirs exist
|
| 195 |
# and make lib even if it's not listed as one (like on amd64/ppc64
|
| 196 |
# which sometimes has lib32/lib64 instead of lib/lib64).
|
| 197 |
# lib should NOT be a symlink to one of the other libdirs.
|
| 198 |
# Old systems with symlinks won't be affected by this change, as the
|
| 199 |
# symlinks already exist and won't get removed, but new systems will
|
| 200 |
# be setup properly.
|
| 201 |
#
|
| 202 |
# I'll be making a script to convert existing systems from symlink to
|
| 203 |
# nosymlink and putting it in /usr/portage/scripts.
|
| 204 |
libdirs=$(get_all_libdirs)
|
| 205 |
: ${libdirs:=lib} # it isn't that we don't trust multilib.eclass...
|
| 206 |
|
| 207 |
# This should be /lib/rcscripts, but we have to support old profiles too.
|
| 208 |
if [[ ${SYMLINK_LIB} == "yes" ]]; then
|
| 209 |
rcscripts_dir="/$(get_abi_LIBDIR ${DEFAULT_ABI})/rcscripts"
|
| 210 |
else
|
| 211 |
rcscripts_dir="/lib/rcscripts"
|
| 212 |
fi
|
| 213 |
|
| 214 |
einfo "Creating directories..."
|
| 215 |
kdir /usr
|
| 216 |
kdir /usr/local
|
| 217 |
kdir /boot
|
| 218 |
kdir /dev
|
| 219 |
kdir /etc/conf.d
|
| 220 |
kdir /etc/cron.daily
|
| 221 |
kdir /etc/cron.hourly
|
| 222 |
kdir /etc/cron.monthly
|
| 223 |
kdir /etc/cron.weekly
|
| 224 |
kdir /etc/env.d
|
| 225 |
dodir /etc/init.d # .keep file might mess up init.d stuff
|
| 226 |
kdir /etc/opt
|
| 227 |
kdir /home
|
| 228 |
if use kernel_linux; then
|
| 229 |
kdir /dev/pts
|
| 230 |
kdir /dev/shm
|
| 231 |
kdir /etc/modules.autoload.d
|
| 232 |
kdir /etc/modules.d
|
| 233 |
fi
|
| 234 |
kdir ${rcscripts_dir}
|
| 235 |
kdir ${rcscripts_dir}/awk
|
| 236 |
kdir ${rcscripts_dir}/sh
|
| 237 |
kdir ${rcscripts_dir}/net.modules.d
|
| 238 |
kdir ${rcscripts_dir}/net.modules.d/helpers.d
|
| 239 |
# Only install /mnt stuff at bootstrap time #88835 / #90022
|
| 240 |
if use build ; then
|
| 241 |
kdir /mnt
|
| 242 |
kdir -m 0700 /mnt/cdrom
|
| 243 |
kdir -m 0700 /mnt/floppy
|
| 244 |
fi
|
| 245 |
kdir /opt
|
| 246 |
kdir -o root -g uucp -m0775 /var/lock
|
| 247 |
kdir /proc
|
| 248 |
kdir -m 0700 /root
|
| 249 |
kdir /sbin
|
| 250 |
kdir /sys # for 2.6 kernels
|
| 251 |
kdir /usr/bin
|
| 252 |
kdir /usr/include
|
| 253 |
kdir /usr/include/asm
|
| 254 |
kdir /usr/include/linux
|
| 255 |
kdir /usr/local/bin
|
| 256 |
kdir /usr/local/games
|
| 257 |
kdir /usr/local/sbin
|
| 258 |
kdir /usr/local/share
|
| 259 |
kdir /usr/local/share/doc
|
| 260 |
kdir /usr/local/share/man
|
| 261 |
kdir /usr/local/src
|
| 262 |
kdir ${PORTDIR}
|
| 263 |
kdir /usr/sbin
|
| 264 |
kdir /usr/share/doc
|
| 265 |
kdir /usr/share/info
|
| 266 |
kdir /usr/share/man
|
| 267 |
kdir /usr/share/misc
|
| 268 |
kdir /usr/src
|
| 269 |
kdir -m 1777 /tmp
|
| 270 |
kdir /var
|
| 271 |
dodir /var/db/pkg # .keep file messes up Portage
|
| 272 |
kdir /var/lib/misc
|
| 273 |
kdir /var/lock/subsys
|
| 274 |
kdir /var/log/news
|
| 275 |
kdir /var/run
|
| 276 |
kdir /var/spool
|
| 277 |
kdir /var/state
|
| 278 |
kdir -m 1777 /var/tmp
|
| 279 |
|
| 280 |
for dir in ${libdirs}; do
|
| 281 |
libdirs_env=${libdirs_env:+$libdirs_env:}/${dir}:/usr/${dir}:/usr/local/${dir}
|
| 282 |
[[ ${dir} == "lib" && ${SYMLINK_LIB} == "yes" ]] && continue
|
| 283 |
kdir /${dir}
|
| 284 |
kdir /usr/${dir}
|
| 285 |
kdir /usr/local/${dir}
|
| 286 |
done
|
| 287 |
|
| 288 |
# Ugly compatibility with stupid ebuilds and old profiles symlinks
|
| 289 |
if [[ ${SYMLINK_LIB} == "yes" ]] ; then
|
| 290 |
rm -r "${D}"/{lib,usr/lib,usr/local/lib} &> /dev/null
|
| 291 |
ksym $(get_abi_LIBDIR ${DEFAULT_ABI}) /lib
|
| 292 |
ksym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/lib
|
| 293 |
ksym $(get_abi_LIBDIR ${DEFAULT_ABI}) /usr/local/lib
|
| 294 |
fi
|
| 295 |
|
| 296 |
if use kernel_linux; then
|
| 297 |
kdir /lib/dev-state
|
| 298 |
kdir /lib/udev-state
|
| 299 |
fi
|
| 300 |
|
| 301 |
# FHS compatibility symlinks stuff
|
| 302 |
ksym /var/tmp /usr/tmp
|
| 303 |
ksym share/man /usr/local/man
|
| 304 |
|
| 305 |
#
|
| 306 |
# Setup files in /etc
|
| 307 |
#
|
| 308 |
insopts -m0644
|
| 309 |
insinto /etc
|
| 310 |
doins -r "${S}"/etc/*
|
| 311 |
|
| 312 |
if use kernel_linux; then
|
| 313 |
fperms 0640 /etc/sysctl.conf
|
| 314 |
fi
|
| 315 |
|
| 316 |
# Install some files to /usr/share/baselayout instead of /etc to keep from
|
| 317 |
# (1) overwriting the user's settings, (2) screwing things up when
|
| 318 |
# attempting to merge files, (3) accidentally packaging up personal files
|
| 319 |
# with quickpkg
|
| 320 |
mv "${D}"/etc/{passwd,group,fstab,hosts,issue.devfix} "${D}"/usr/share/baselayout
|
| 321 |
|
| 322 |
if use userland_GNU; then
|
| 323 |
fperms 0600 /etc/shadow
|
| 324 |
mv "${D}"/etc/shadow "${D}"/usr/share/baselayout
|
| 325 |
else
|
| 326 |
rm "${D}"/etc/shadow
|
| 327 |
fi
|
| 328 |
|
| 329 |
# doinitd doesnt respect symlinks
|
| 330 |
dodir /etc/init.d
|
| 331 |
cp -P "${S}"/init.d/* "${D}"/etc/init.d/ || die "doinitd"
|
| 332 |
#doinitd "${S}"/init.d/* || die "doinitd"
|
| 333 |
doconfd "${S}"/etc/conf.d/* || die "doconfd"
|
| 334 |
doenvd "${S}"/etc/env.d/* || die "doenvd"
|
| 335 |
insinto /etc/modules.autoload.d
|
| 336 |
doins "${S}"/etc/modules.autoload.d/*
|
| 337 |
insinto /etc/modules.d
|
| 338 |
doins "${S}"/etc/modules.d/*
|
| 339 |
|
| 340 |
# Special-case uglyness... For people updating from lib32 -> lib amd64
|
| 341 |
# profiles, keep lib32 in the search path while it's around
|
| 342 |
if has_multilib_profile && [ -d /lib32 -o -d /usr/lib32 ] && ! hasq lib32 ${libdirs}; then
|
| 343 |
libdirs_env="${libdirs_env}:/lib32:/usr/lib32:/usr/local/lib32"
|
| 344 |
fi
|
| 345 |
|
| 346 |
# List all the multilib libdirs in /etc/env/04multilib (only if they're
|
| 347 |
# actually different from the normal
|
| 348 |
if has_multilib_profile || [[ $(get_libdir) != "lib" || -n ${CONF_MULTILIBDIR} ]]; then
|
| 349 |
echo "LDPATH=\"${libdirs_env}\"" > ${D}/etc/env.d/04multilib
|
| 350 |
fi
|
| 351 |
|
| 352 |
# As of baselayout-1.10-1-r1, sysvinit is its own package again, and
|
| 353 |
# provides the inittab itself
|
| 354 |
rm -f "${D}"/etc/inittab
|
| 355 |
|
| 356 |
# Stash the rc-lists for use during pkg_postinst
|
| 357 |
cp -r "${S}"/rc-lists "${D}"/usr/share/baselayout
|
| 358 |
|
| 359 |
# rc-scripts version for testing of features that *should* be present
|
| 360 |
echo "Gentoo Base System version ${PV}" > ${D}/etc/gentoo-release
|
| 361 |
|
| 362 |
#
|
| 363 |
# Setup files related to /dev
|
| 364 |
#
|
| 365 |
if use kernel_linux; then
|
| 366 |
into /
|
| 367 |
dosbin "${S}"/sbin/MAKEDEV
|
| 368 |
dosym ../../sbin/MAKEDEV /usr/sbin/MAKEDEV
|
| 369 |
dosym ../sbin/MAKEDEV /dev/MAKEDEV
|
| 370 |
fi
|
| 371 |
|
| 372 |
#
|
| 373 |
# Setup files in /bin
|
| 374 |
#
|
| 375 |
cd "${S}"/bin
|
| 376 |
dobin rc-status
|
| 377 |
|
| 378 |
#
|
| 379 |
# Setup files in /sbin
|
| 380 |
#
|
| 381 |
cd "${S}"/sbin
|
| 382 |
into /
|
| 383 |
dosbin rc rc-update
|
| 384 |
# Need this in /sbin, as it could be run before
|
| 385 |
# /usr is mounted.
|
| 386 |
dosbin modules-update
|
| 387 |
# Compat symlinks until I can get things synced.
|
| 388 |
dosym modules-update /sbin/update-modules
|
| 389 |
dosym ../../sbin/modules-update /usr/sbin/update-modules
|
| 390 |
# These moved from /etc/init.d/ to /sbin to help newb systems
|
| 391 |
# from breaking
|
| 392 |
dosbin runscript.sh functions.sh
|
| 393 |
|
| 394 |
# Compat symlinks between /etc/init.d and /sbin
|
| 395 |
# (some stuff have hardcoded paths)
|
| 396 |
dosym ../../sbin/depscan.sh /etc/init.d/depscan.sh
|
| 397 |
dosym ../../sbin/runscript.sh /etc/init.d/runscript.sh
|
| 398 |
dosym ../../sbin/functions.sh /etc/init.d/functions.sh
|
| 399 |
|
| 400 |
#
|
| 401 |
# Setup files in /lib/rcscripts
|
| 402 |
# These are support files for other things in baselayout that needn't be
|
| 403 |
# under CONFIG_PROTECTed /etc
|
| 404 |
#
|
| 405 |
cd "${S}"/sbin
|
| 406 |
exeinto ${rcscripts_dir}/sh
|
| 407 |
doexe rc-services.sh rc-daemon.sh rc-help.sh
|
| 408 |
|
| 409 |
# We can only install new, fast awk versions of scripts
|
| 410 |
# if 'build' or 'bootstrap' is not in USE. This will
|
| 411 |
# change if we have sys-apps/gawk-3.1.1-r1 or later in
|
| 412 |
# the build image ...
|
| 413 |
if ! use build; then
|
| 414 |
# This is for new depscan.sh and env-update.sh
|
| 415 |
# written in awk
|
| 416 |
cd "${S}"/sbin
|
| 417 |
into /
|
| 418 |
dosbin depscan.sh
|
| 419 |
dosbin env-update.sh
|
| 420 |
insinto ${rcscripts_dir}/awk
|
| 421 |
doins "${S}"/src/awk/*.awk
|
| 422 |
fi
|
| 423 |
|
| 424 |
# Original design had these in /etc/net.modules.d but that is too
|
| 425 |
# problematic with CONFIG_PROTECT
|
| 426 |
dodir ${rcscripts_dir}
|
| 427 |
cp -pPR "${S}"/lib/rcscripts/net.modules.d ${D}${rcscripts_dir}
|
| 428 |
chown -R root:0 ${D}${rcscripts_dir}
|
| 429 |
|
| 430 |
#
|
| 431 |
# Install baselayout documentation
|
| 432 |
#
|
| 433 |
if ! use build ; then
|
| 434 |
doman "${S}"/man/*.*
|
| 435 |
docinto /
|
| 436 |
dodoc ${FILESDIR}/copyright
|
| 437 |
dodoc "${S}"/ChangeLog
|
| 438 |
fi
|
| 439 |
|
| 440 |
#
|
| 441 |
# Install baselayout utilities
|
| 442 |
#
|
| 443 |
cd "${S}"/src
|
| 444 |
make DESTDIR="${D}" install || die
|
| 445 |
|
| 446 |
# Hack to fix bug 9849, continued in pkg_postinst
|
| 447 |
unkdir
|
| 448 |
}
|
| 449 |
|
| 450 |
# Support function for remapping old wireless dns vars
|
| 451 |
remap_dns_vars() {
|
| 452 |
local f="$1"
|
| 453 |
|
| 454 |
if [[ -f ${ROOT}/etc/conf.d/${f} ]]; then
|
| 455 |
sed -e 's/\<domain_/dns_domain_/g' \
|
| 456 |
-e 's/\<mac_domain_/mac_dns_domain_/g' \
|
| 457 |
-e 's/\<nameservers_/dns_servers_/g' \
|
| 458 |
-e 's/\<mac_nameservers_/mac_dns_servers_/g' \
|
| 459 |
-e 's/\<searchdomains_/dns_search_domains_/g' \
|
| 460 |
-e 's/\<mac_searchdomains_/mac_dns_search_domains_/g' \
|
| 461 |
${ROOT}/etc/conf.d/${f} > ${IMAGE}/etc/conf.d/${f}
|
| 462 |
fi
|
| 463 |
}
|
| 464 |
|
| 465 |
pkg_preinst() {
|
| 466 |
if [[ -f ${ROOT}/etc/modules.autoload && \
|
| 467 |
! -d ${ROOT}/etc/modules.autoload.d ]]; then
|
| 468 |
mkdir -p ${ROOT}/etc/modules.autoload.d
|
| 469 |
mv -f ${ROOT}/etc/modules.autoload \
|
| 470 |
${ROOT}/etc/modules.autoload.d/kernel-2.4
|
| 471 |
ln -snf modules.autoload.d/kernel-2.4 ${ROOT}/etc/modules.autoload
|
| 472 |
fi
|
| 473 |
|
| 474 |
# Change some vars introduced in baselayout-1.11.0 before we go stable
|
| 475 |
# The new names make more sense and allow nis_domain
|
| 476 |
# for use in baselayout-1.12.0
|
| 477 |
remap_dns_vars net
|
| 478 |
remap_dns_vars wireless
|
| 479 |
}
|
| 480 |
|
| 481 |
pkg_postinst() {
|
| 482 |
local x y
|
| 483 |
|
| 484 |
# Reincarnate dirs from kdir/unkdir (hack for bug 9849)
|
| 485 |
einfo "Creating directories and .keep files."
|
| 486 |
einfo "Some of these might fail if they're read-only mounted"
|
| 487 |
einfo "filesystems, for example /dev or /proc. That's okay!"
|
| 488 |
source "${ROOT}"/usr/share/baselayout/mkdirs.sh
|
| 489 |
source "${ROOT}"/usr/share/baselayout/mklinks.sh
|
| 490 |
|
| 491 |
# This could be done in src_install, which would have the benefit of
|
| 492 |
# (1) devices.tar.bz2 would show up in CONTENTS
|
| 493 |
# (2) binary installations would be faster... just untar the devices tarball
|
| 494 |
# instead of needing to run MAKEDEV
|
| 495 |
# However the most common cases are that people are either updating
|
| 496 |
# baselayout or installing from scratch. In the installation case, it's no
|
| 497 |
# different to have here instead of src_install. In the update case, we
|
| 498 |
# save a couple minutes time by refraining from building the unnecessary
|
| 499 |
# tarball.
|
| 500 |
if use kernel_linux && [[ ! -f "${ROOT}/lib/udev-state/devices.tar.bz2" ]]; then
|
| 501 |
# Create a directory in which to work
|
| 502 |
x=$(emktemp -d ${ROOT}/tmp/devnodes.XXXXXXXXX) \
|
| 503 |
&& cd "${x}" || die 'mktemp failed'
|
| 504 |
|
| 505 |
# Create temp device nodes
|
| 506 |
echo
|
| 507 |
einfo "Making device node tarball (this could take a couple minutes)"
|
| 508 |
PATH=${ROOT}/sbin:${PATH} create_dev_nodes
|
| 509 |
|
| 510 |
# Now create tarball that can also be used for udev.
|
| 511 |
# Need GNU tar for -j so call it by absolute path.
|
| 512 |
/bin/tar --one-file-system -cjpf "${ROOT}/lib/udev-state/devices.tar.bz2" *
|
| 513 |
rm -r *
|
| 514 |
cd ..
|
| 515 |
rmdir "${x}"
|
| 516 |
fi
|
| 517 |
|
| 518 |
# We don't want to create devices if this is not a bootstrap and devfs
|
| 519 |
# is used, as this was the cause for all the devfs problems we had
|
| 520 |
if use kernel_linux && use build || use bootstrap; then
|
| 521 |
if [[ ! -e "${ROOT}/dev/.devfsd" && ! -e "${ROOT}/dev/.udev" ]]; then
|
| 522 |
einfo "Populating /dev with device nodes..."
|
| 523 |
cd ${ROOT}/dev || die
|
| 524 |
/bin/tar xjpf "${ROOT}/lib/udev-state/devices.tar.bz2" || die
|
| 525 |
fi
|
| 526 |
fi
|
| 527 |
|
| 528 |
# Create /boot/boot symlink in pkg_postinst because sometimes
|
| 529 |
# /boot is a FAT filesystem. When that is the case, then the
|
| 530 |
# symlink will fail. Consequently, if we create it in
|
| 531 |
# src_install, then merge will fail. AFAIK there is no point to
|
| 532 |
# this symlink except for misconfigured grubs. See bug 50108
|
| 533 |
# (05 May 2004 agriffis)
|
| 534 |
ln -sn . "${ROOT}"/boot/boot 2>/dev/null
|
| 535 |
|
| 536 |
# Set up default runlevel symlinks
|
| 537 |
# This used to be done in src_install but required knowledge of ${ROOT},
|
| 538 |
# which meant that it was effectively broken for binary installs.
|
| 539 |
if [[ -z $(/bin/ls "${ROOT}"/etc/runlevels 2>/dev/null) ]]; then
|
| 540 |
for x in boot default nonetwork single; do
|
| 541 |
einfo "Creating default runlevel symlinks for ${x}"
|
| 542 |
mkdir -p "${ROOT}"/etc/runlevels/${x}
|
| 543 |
for y in $(<"${ROOT}"/usr/share/baselayout/rc-lists/${x}); do
|
| 544 |
if [[ ! -e ${ROOT}/etc/init.d/${y} ]]; then
|
| 545 |
ewarn "init.d/${y} not found -- ignoring"
|
| 546 |
else
|
| 547 |
ln -sfn /etc/init.d/${y} \
|
| 548 |
"${ROOT}"/etc/runlevels/${x}/${y}
|
| 549 |
fi
|
| 550 |
done
|
| 551 |
done
|
| 552 |
fi
|
| 553 |
|
| 554 |
# Create /etc/hosts in pkg_postinst so we don't overwrite an
|
| 555 |
# existing file during bootstrap
|
| 556 |
if [[ ! -e ${ROOT}/etc/hosts ]]; then
|
| 557 |
cp ${ROOT}/usr/share/baselayout/hosts ${ROOT}/etc
|
| 558 |
fi
|
| 559 |
|
| 560 |
# Touching /etc/passwd and /etc/shadow after install can be fatal, as many
|
| 561 |
# new users do not update them properly... see src_install() for why they
|
| 562 |
# are in /usr/share/baselayout/
|
| 563 |
for x in passwd shadow group fstab ; do
|
| 564 |
if [[ -e ${ROOT}/etc/${x} ]] ; then
|
| 565 |
touch "${ROOT}/etc/${x}"
|
| 566 |
else
|
| 567 |
cp "${ROOT}/usr/share/baselayout/${x}" "${ROOT}/etc/${x}"
|
| 568 |
fi
|
| 569 |
done
|
| 570 |
|
| 571 |
# Under what circumstances would mtab be a symlink? It would be
|
| 572 |
# nice if there were an explanatory comment here
|
| 573 |
if use kernel_linux && [[ -L ${ROOT}/etc/mtab ]]; then
|
| 574 |
rm -f "${ROOT}/etc/mtab"
|
| 575 |
if [[ ${ROOT} == / ]]; then
|
| 576 |
cp /proc/mounts "${ROOT}/etc/mtab"
|
| 577 |
else
|
| 578 |
touch "${ROOT}/etc/mtab"
|
| 579 |
fi
|
| 580 |
fi
|
| 581 |
|
| 582 |
# We should only install empty files if these files don't already exist.
|
| 583 |
[[ -e ${ROOT}/var/log/lastlog ]] || \
|
| 584 |
touch "${ROOT}/var/log/lastlog"
|
| 585 |
[[ -e ${ROOT}/var/run/utmp ]] || \
|
| 586 |
install -m 0664 -g utmp /dev/null "${ROOT}/var/run/utmp"
|
| 587 |
[[ -e ${ROOT}/var/log/wtmp ]] || \
|
| 588 |
install -m 0664 -g utmp /dev/null "${ROOT}/var/log/wtmp"
|
| 589 |
|
| 590 |
# Reload init to fix unmounting problems of / on next reboot.
|
| 591 |
# This is really needed, as without the new version of init cause init
|
| 592 |
# not to quit properly on reboot, and causes a fsck of / on next reboot.
|
| 593 |
if [[ ${ROOT} == / ]] && ! use build && ! use bootstrap; then
|
| 594 |
# Regenerate init.d dependency tree
|
| 595 |
/sbin/depscan.sh &>/dev/null
|
| 596 |
|
| 597 |
# Regenerate /etc/modules.conf, else it will fail at next boot
|
| 598 |
einfo "Updating module dependencies..."
|
| 599 |
/sbin/modules-update force &>/dev/null
|
| 600 |
else
|
| 601 |
rm -f ${ROOT}/etc/modules.conf
|
| 602 |
fi
|
| 603 |
|
| 604 |
# Enable shadow groups (we need ROOT=/ here, as grpconv only
|
| 605 |
# operate on / ...).
|
| 606 |
if use userland_GNU && [[ ${ROOT} == / && \
|
| 607 |
! -f /etc/gshadow && -x /usr/sbin/grpck && -x /usr/sbin/grpconv ]]
|
| 608 |
then
|
| 609 |
if /usr/sbin/grpck -r &>/dev/null; then
|
| 610 |
/usr/sbin/grpconv
|
| 611 |
else
|
| 612 |
echo
|
| 613 |
ewarn "Running 'grpck' returned errors. Please run it by hand, and then"
|
| 614 |
ewarn "run 'grpconv' afterwards!"
|
| 615 |
echo
|
| 616 |
fi
|
| 617 |
fi
|
| 618 |
|
| 619 |
# This is also written in src_install (so it's in CONTENTS), but
|
| 620 |
# write it here so that the new version is immediately in the file
|
| 621 |
# (without waiting for the user to do etc-update)
|
| 622 |
rm -f ${ROOT}/etc/._cfg????_gentoo-release
|
| 623 |
echo "Gentoo Base System version ${PV}" > ${ROOT}/etc/gentoo-release
|
| 624 |
|
| 625 |
echo
|
| 626 |
einfo "Please be sure to update all pending '._cfg*' files in /etc,"
|
| 627 |
einfo "else things might break at your next reboot! You can use 'etc-update'"
|
| 628 |
einfo "to accomplish this:"
|
| 629 |
einfo
|
| 630 |
einfo " # etc-update"
|
| 631 |
echo
|
| 632 |
|
| 633 |
for f in /etc/init.d/net.eth*; do
|
| 634 |
[[ -L ${f} ]] && continue
|
| 635 |
echo
|
| 636 |
einfo "WARNING: You have older net.eth* files in ${ROOT}/etc/init.d/"
|
| 637 |
einfo "They need to be converted to symlinks to net.lo. If you haven't"
|
| 638 |
einfo "made personal changes to those files, you can update with the"
|
| 639 |
einfo "following command:"
|
| 640 |
einfo
|
| 641 |
einfo " # /bin/ls /etc/init.d/net.eth* | xargs -n1 ln -sfvn net.lo"
|
| 642 |
echo
|
| 643 |
break
|
| 644 |
done
|
| 645 |
|
| 646 |
if sed -e 's/#.*//' ${ROOT}/etc/conf.d/{net,wireless} 2>/dev/null \
|
| 647 |
| egrep -q '\<(domain|nameservers|searchdomains)_' ; then
|
| 648 |
echo
|
| 649 |
ewarn "You have depreciated variables in ${ROOT}/etc/conf.d/net"
|
| 650 |
ewarn "or ${ROOT}/etc/conf.d/wireless"
|
| 651 |
ewarn
|
| 652 |
ewarn "domain_* -> dns_domain_*"
|
| 653 |
ewarn "nameservers_* -> dns_servers_*"
|
| 654 |
ewarn "searchdomains_* -> dns_search_domains_*"
|
| 655 |
ewarn
|
| 656 |
ewarn "They have been converted for you - ensure that you"
|
| 657 |
ewarn "update them via 'etc-update'"
|
| 658 |
echo
|
| 659 |
fi
|
| 660 |
|
| 661 |
if sed -e 's/#.*//' ${ROOT}/etc/conf.d/net 2>/dev/null \
|
| 662 |
| egrep -q '\<(ifconfig|aliases|broadcasts|netmasks|inet6|ipaddr|iproute)_'; then
|
| 663 |
echo
|
| 664 |
ewarn "You are using deprecated variables in ${ROOT}/etc/conf.d/net"
|
| 665 |
ewarn
|
| 666 |
ewarn "You are advised to review the new configuration variables as"
|
| 667 |
ewarn "found in ${ROOT}/etc/conf.d/net.example as there is no"
|
| 668 |
ewarn "guarantee that they will work in future versions."
|
| 669 |
echo
|
| 670 |
fi
|
| 671 |
}
|