/[gentoo-x86]/sys-apps/openrc/openrc-0.9.9.2.ebuild
Gentoo

Contents of /sys-apps/openrc/openrc-0.9.9.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download)
Sun Feb 26 03:40:01 2012 UTC (2 years, 4 months ago) by williamh
Branch: MAIN
version bump for bug #405713

(Portage version: 2.2.0_alpha88/cvs/Linux i686)

1 williamh 1.1 # Copyright 1999-2012 Gentoo Foundation
2     # Distributed under the terms of the GNU General Public License v2
3     # $Header: $
4    
5     EAPI=4
6    
7     EGIT_REPO_URI="git://git.overlays.gentoo.org/proj/${PN}.git"
8     [[ ${PV} == "9999" ]] && SCM_ECLASS="git-2"
9     inherit eutils flag-o-matic multilib pam toolchain-funcs ${SCM_ECLASS}
10     unset SCM_ECLASS
11    
12     DESCRIPTION="OpenRC manages the services, startup and shutdown of a host"
13     HOMEPAGE="http://www.gentoo.org/proj/en/base/openrc/"
14     if [[ ${PV} != "9999" ]] ; then
15     SRC_URI="mirror://gentoo/${P}.tar.bz2"
16     KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~sparc-fbsd ~x86 ~x86-fbsd"
17     fi
18    
19     LICENSE="BSD-2"
20     SLOT="0"
21     IUSE="debug elibc_glibc ncurses pam selinux static-libs unicode kernel_linux kernel_FreeBSD"
22    
23     RDEPEND="virtual/init
24     kernel_FreeBSD? ( || ( >=sys-freebsd/freebsd-ubin-9.0_rc sys-process/fuser-bsd ) )
25     elibc_glibc? ( >=sys-libs/glibc-2.5 )
26     ncurses? ( sys-libs/ncurses )
27     pam? ( sys-auth/pambase )
28     >=sys-apps/baselayout-2.0.0
29     kernel_linux? (
30     sys-process/psmisc
31     )
32     !<sys-fs/udev-133"
33     DEPEND="${RDEPEND}
34     virtual/os-headers"
35    
36     make_args() {
37     unset LIBDIR #266688
38    
39     MAKE_ARGS="${MAKE_ARGS} LIBNAME=$(get_libdir) LIBEXECDIR=/$(get_libdir)/rc"
40    
41     local brand="Unknown"
42     if use kernel_linux ; then
43     MAKE_ARGS="${MAKE_ARGS} OS=Linux"
44     brand="Linux"
45     elif use kernel_FreeBSD ; then
46     MAKE_ARGS="${MAKE_ARGS} OS=FreeBSD"
47     brand="FreeBSD"
48     fi
49     if use selinux; then
50     MAKE_ARGS="${MAKE_ARGS} MKSELINUX=yes"
51     fi
52     export BRANDING="Gentoo ${brand}"
53     if ! use static-libs; then
54     MAKE_ARGS="${MAKE_ARGS} MKSTATICLIBS=no"
55     fi
56     }
57    
58     pkg_setup() {
59     export DEBUG=$(usev debug)
60     export MKPAM=$(usev pam)
61     export MKTERMCAP=$(usev ncurses)
62     }
63    
64     src_prepare() {
65     sed -i 's:0444:0644:' mk/sys.mk || die
66     sed -i "/^DIR/s:/openrc:/${PF}:" doc/Makefile || die #241342
67    
68     if [[ ${PV} == "9999" ]] ; then
69     local ver="git-${EGIT_VERSION:0:6}"
70     sed -i "/^GITVER[[:space:]]*=/s:=.*:=${ver}:" mk/git.mk || die
71     fi
72    
73     # Allow user patches to be applied without modifying the ebuild
74     epatch_user
75     }
76    
77     src_compile() {
78     make_args
79    
80     tc-export CC AR RANLIB
81     emake ${MAKE_ARGS}
82     }
83    
84     # set_config <file> <option name> <yes value> <no value> test
85     # a value of "#" will just comment out the option
86     set_config() {
87     local file="${D}/$1" var=$2 val com
88     eval "${@:5}" && val=$3 || val=$4
89     [[ ${val} == "#" ]] && com="#" && val='\2'
90     sed -i -r -e "/^#?${var}=/{s:=([\"'])?([^ ]*)\1?:=\1${val}\1:;s:^#?:${com}:}" "${file}"
91     }
92    
93     set_config_yes_no() {
94     set_config "$1" "$2" YES NO "${@:3}"
95     }
96    
97     src_install() {
98     make_args
99     emake ${MAKE_ARGS} DESTDIR="${D}" install
100    
101     # move the shared libs back to /usr so ldscript can install
102     # more of a minimal set of files
103     # disabled for now due to #270646
104     #mv "${D}"/$(get_libdir)/lib{einfo,rc}* "${D}"/usr/$(get_libdir)/ || die
105     #gen_usr_ldscript -a einfo rc
106     gen_usr_ldscript libeinfo.so
107     gen_usr_ldscript librc.so
108    
109     keepdir /$(get_libdir)/rc/{init.d,tmp}
110    
111     # Backup our default runlevels
112     dodir /usr/share/"${PN}"
113     cp -PR "${D}"/etc/runlevels "${D}"/usr/share/${PN} || die
114     rm -rf "${D}"/etc/runlevels
115    
116     # Install the default net configuration
117     doconfd conf.d/net
118    
119     # Setup unicode defaults for silly unicode users
120     set_config_yes_no /etc/rc.conf unicode use unicode
121    
122     # Cater to the norm
123     set_config_yes_no /etc/conf.d/keymaps windowkeys '(' use x86 '||' use amd64 ')'
124    
125     # On HPPA, do not run consolefont by default (bug #222889)
126     if use hppa; then
127     rm -f "${D}"/usr/share/openrc/runlevels/boot/consolefont
128     fi
129    
130     # Support for logfile rotation
131     insinto /etc/logrotate.d
132     newins "${FILESDIR}"/openrc.logrotate openrc
133    
134     # install the gentoo pam.d file
135     newpamd "${FILESDIR}"/start-stop-daemon.pam start-stop-daemon
136     }
137    
138     add_boot_init() {
139     local initd=$1
140     local runlevel=${2:-boot}
141     # if the initscript is not going to be installed and is not
142     # currently installed, return
143     [[ -e ${D}/etc/init.d/${initd} || -e ${ROOT}/etc/init.d/${initd} ]] \
144     || return
145     [[ -e ${ROOT}/etc/runlevels/${runlevel}/${initd} ]] && return
146    
147     # if runlevels dont exist just yet, then create it but still flag
148     # to pkg_postinst that it needs real setup #277323
149     if [[ ! -d ${ROOT}/etc/runlevels/${runlevel} ]] ; then
150     mkdir -p "${ROOT}"/etc/runlevels/${runlevel}
151     touch "${ROOT}"/etc/runlevels/.add_boot_init.created
152     fi
153    
154     elog "Auto-adding '${initd}' service to your ${runlevel} runlevel"
155     ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/${runlevel}/${initd}
156     }
157     add_boot_init_mit_config() {
158     local config=$1 initd=$2
159     if [[ -e ${ROOT}${config} ]] ; then
160     if [[ -n $(sed -e 's:#.*::' -e '/^[[:space:]]*$/d' "${ROOT}"/${config}) ]] ; then
161     add_boot_init ${initd}
162     fi
163     fi
164     }
165    
166     pkg_preinst() {
167     local f LIBDIR=$(get_libdir)
168    
169     # default net script is just comments, so no point in biting people
170     # in the ass by accident. we save in preinst so that the package
171     # manager doesnt go throwing etc-update crap at us -- postinst is
172     # too late to prevent that. this behavior also lets us keep the
173     # file in the CONTENTS for binary packages.
174     [[ -e ${ROOT}/etc/conf.d/net ]] && cp "${ROOT}"/etc/conf.d/net "${D}"/etc/conf.d/
175    
176     # avoid default thrashing in conf.d files when possible #295406
177     if [[ -e ${ROOT}/etc/conf.d/hostname ]] ; then
178     (
179     unset hostname HOSTNAME
180     source "${ROOT}"/etc/conf.d/hostname
181     : ${hostname:=${HOSTNAME}}
182     [[ -n ${hostname} ]] && set_config /etc/conf.d/hostname hostname "${hostname}"
183     )
184     fi
185    
186     # upgrade timezone file ... do it before moving clock
187     if [[ -e ${ROOT}/etc/conf.d/clock && ! -e ${ROOT}/etc/timezone ]] ; then
188     (
189     unset TIMEZONE
190     source "${ROOT}"/etc/conf.d/clock
191     [[ -n ${TIMEZONE} ]] && echo "${TIMEZONE}" > "${ROOT}"/etc/timezone
192     )
193     fi
194    
195     # /etc/conf.d/clock moved to /etc/conf.d/hwclock
196     local clock
197     use kernel_FreeBSD && clock="adjkerntz" || clock="hwclock"
198     if [[ -e ${ROOT}/etc/conf.d/clock ]] ; then
199     mv "${ROOT}"/etc/conf.d/clock "${ROOT}"/etc/conf.d/${clock}
200     fi
201     if [[ -e ${ROOT}/etc/init.d/clock ]] ; then
202     rm -f "${ROOT}"/etc/init.d/clock
203     fi
204     if [[ -L ${ROOT}/etc/runlevels/boot/clock ]] ; then
205     rm -f "${ROOT}"/etc/runlevels/boot/clock
206     ln -snf /etc/init.d/${clock} "${ROOT}"/etc/runlevels/boot/${clock}
207     fi
208     if [[ -L ${ROOT}${LIBDIR}/rc/init.d/started/clock ]] ; then
209     rm -f "${ROOT}${LIBDIR}"/rc/init.d/started/clock
210     ln -snf /etc/init.d/${clock} "${ROOT}${LIBDIR}"/rc/init.d/started/${clock}
211     fi
212    
213     # /etc/conf.d/rc is no longer used for configuration
214     if [[ -e ${ROOT}/etc/conf.d/rc ]] ; then
215     elog "/etc/conf.d/rc is no longer used for configuration."
216     elog "Please migrate your settings to /etc/rc.conf as applicable"
217     elog "and delete /etc/conf.d/rc"
218     fi
219    
220     # force net init.d scripts into symlinks
221     for f in "${ROOT}"/etc/init.d/net.* ; do
222     [[ -e ${f} ]] || continue # catch net.* not matching anything
223     [[ ${f} == */net.lo ]] && continue # real file now
224     [[ ${f} == *.openrc.bak ]] && continue
225     if [[ ! -L ${f} ]] ; then
226     elog "Moved net service '${f##*/}' to '${f##*/}.openrc.bak' to force a symlink."
227     elog "You should delete '${f##*/}.openrc.bak' if you don't need it."
228     mv "${f}" "${f}.openrc.bak"
229     ln -snf net.lo "${f}"
230     fi
231     done
232    
233     # termencoding was added in 0.2.1 and needed in boot
234     has_version ">=sys-apps/openrc-0.2.1" || add_boot_init termencoding
235    
236     # swapfiles was added in 0.9.9 and needed in boot (february 2012)
237     has_version ">=sys-apps/openrc-0.9.9" || add_boot_init swapfiles
238    
239     # set default interactive shell to sulogin if it exists
240     set_config /etc/rc.conf rc_shell /sbin/sulogin "#" test -e /sbin/sulogin
241    
242     has_version sys-apps/openrc || migrate_from_baselayout_1
243     has_version ">=sys-apps/openrc-0.4.0" || migrate_udev_init_script
244     }
245    
246     # >=openrc-0.4.0 no longer loads the udev addon
247     migrate_udev_init_script() {
248     # make sure udev is in sysinit if it was enabled before
249     local enable_udev=false
250     local rc_devices=$(
251     [[ -f /etc/rc.conf ]] && source /etc/rc.conf
252     [[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc
253     echo "${rc_devices:-${RC_DEVICES:-auto}}"
254     )
255     case ${rc_devices} in
256     udev|auto)
257     enable_udev=true
258     ;;
259     esac
260    
261     if $enable_udev; then
262     add_boot_init udev sysinit
263     add_boot_init udev-postmount default
264     fi
265     }
266    
267     migrate_from_baselayout_1() {
268     # baselayout boot init scripts have been split out
269     for f in $(cd "${D}"/usr/share/${PN}/runlevels/boot || exit; echo *) ; do
270     # baselayout-1 is always "old" net, so ignore "new" net
271     [[ ${f} == "network" ]] && continue
272    
273     add_boot_init ${f}
274     done
275    
276     # Try to auto-add some addons when possible
277     add_boot_init_mit_config /etc/conf.d/cryptfs dmcrypt
278     add_boot_init_mit_config /etc/conf.d/dmcrypt dmcrypt
279     add_boot_init_mit_config /etc/mdadm.conf mdraid
280     add_boot_init_mit_config /etc/evms.conf evms
281     [[ -e ${ROOT}/sbin/dmsetup ]] && add_boot_init device-mapper
282     [[ -e ${ROOT}/sbin/vgscan ]] && add_boot_init lvm
283     elog "Add on services (such as RAID/dmcrypt/LVM/etc...) are now stand alone"
284     elog "init.d scripts. If you use such a thing, make sure you have the"
285     elog "required init.d scripts added to your boot runlevel."
286    
287     # Upgrade our state for baselayout-1 users
288     if [[ ! -e ${ROOT}${LIBDIR}/rc/init.d/started ]] ; then
289     (
290     [[ -e ${ROOT}/etc/conf.d/rc ]] && source "${ROOT}"/etc/conf.d/rc
291     svcdir=${svcdir:-/var/lib/init.d}
292     if [[ ! -d ${ROOT}${svcdir}/started ]] ; then
293     ewarn "No state found, and no state exists"
294     elog "You should reboot this host"
295     else
296     mkdir -p "${ROOT}${LIBDIR}/rc/init.d"
297     einfo "Moving state from ${ROOT}${svcdir} to ${ROOT}${LIBDIR}/rc/init.d"
298     mv "${ROOT}${svcdir}"/* "${ROOT}${LIBDIR}"/rc/init.d
299     rm -rf "${ROOT}${LIBDIR}"/rc/init.d/daemons \
300     "${ROOT}${LIBDIR}"/rc/init.d/console
301     umount "${ROOT}${svcdir}" 2>/dev/null
302     rm -rf "${ROOT}${svcdir}"
303     fi
304     )
305     fi
306    
307     # Handle the /etc/modules.autoload.d -> /etc/conf.d/modules transition
308     if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
309     elog "Converting your /etc/modules.autoload.d/ files to /etc/conf.d/modules"
310     rm -f "${ROOT}"/etc/modules.autoload.d/.keep*
311     rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
312     if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
313     local f v
314     for f in "${ROOT}"/etc/modules.autoload.d/* ; do
315     v=${f##*/}
316     v=${v#kernel-}
317     v=${v//[^[:alnum:]]/_}
318     gawk -v v="${v}" -v f="${f##*/}" '
319     BEGIN { print "\n### START: Auto-converted from " f "\n" }
320     {
321     if ($0 ~ /^[^#]/) {
322     print "modules_" v "=\"${modules_" v "} " $1 "\""
323     gsub(/[^[:alnum:]]/, "_", $1)
324     printf "module_" $1 "_args_" v "=\""
325     for (i = 2; i <= NF; ++i) {
326     if (i > 2)
327     printf " "
328     printf $i
329     }
330     print "\"\n"
331     } else
332     print
333     }
334     END { print "\n### END: Auto-converted from " f "\n" }
335     ' "${f}" >> "${D}"/etc/conf.d/modules
336     done
337     rm -f "${f}"
338     rmdir "${ROOT}"/etc/modules.autoload.d 2>/dev/null
339     fi
340     fi
341     }
342    
343     pkg_postinst() {
344     local LIBDIR=$(get_libdir)
345    
346     # Remove old baselayout links
347     rm -f "${ROOT}"/etc/runlevels/boot/{check{fs,root},rmnologin}
348     rm -f "${ROOT}"/etc/init.d/{depscan,runscript}.sh
349    
350     # Make our runlevels if they don't exist
351     if [[ ! -e ${ROOT}/etc/runlevels ]] || [[ -e ${ROOT}/etc/runlevels/.add_boot_init.created ]] ; then
352     einfo "Copying across default runlevels"
353     cp -RPp "${ROOT}"/usr/share/${PN}/runlevels "${ROOT}"/etc
354     rm -f "${ROOT}"/etc/runlevels/.add_boot_init.created
355     else
356     if [[ ! -e ${ROOT}/etc/runlevels/sysinit/devfs ]] ; then
357     mkdir -p "${ROOT}"/etc/runlevels/sysinit
358     cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/sysinit/* \
359     "${ROOT}"/etc/runlevels/sysinit
360     fi
361     if [[ ! -e ${ROOT}/etc/runlevels/shutdown/mount-ro ]] ; then
362     mkdir -p "${ROOT}"/etc/runlevels/shutdown
363     cp -RPp "${ROOT}"/usr/share/${PN}/runlevels/shutdown/* \
364     "${ROOT}"/etc/runlevels/shutdown
365     fi
366     fi
367    
368     # /etc/conf.d/net.example is no longer valid
369     local NET_EXAMPLE="${ROOT}/etc/conf.d/net.example"
370     local NET_MD5='8ebebfa07441d39eb54feae0ee4c8210'
371     if [[ -e "${NET_EXAMPLE}" ]] ; then
372     if [[ $(md5sum "${NET_EXAMPLE}") == ${NET_MD5}* ]]; then
373     rm -f "${NET_EXAMPLE}"
374     elog "${NET_EXAMPLE} has been removed."
375     else
376     sed -i '1i# This file is obsolete.\n' "${NET_EXAMPLE}"
377     elog "${NET_EXAMPLE} should be removed."
378     fi
379     elog "The new file is ${ROOT}/usr/share/doc/${PF}/net.example"
380     fi
381    
382     # /etc/conf.d/wireless.example is no longer valid
383     local WIRELESS_EXAMPLE="${ROOT}/etc/conf.d/wireless.example"
384     local WIRELESS_MD5='d1fad7da940bf263c76af4d2082124a3'
385     if [[ -e "${WIRELESS_EXAMPLE}" ]] ; then
386     if [[ $(md5sum "${WIRELESS_EXAMPLE}") == ${WIRELESS_MD5}* ]]; then
387     rm -f "${WIRELESS_EXAMPLE}"
388     elog "${WIRELESS_EXAMPLE} is deprecated and has been removed."
389     else
390     sed -i '1i# This file is obsolete.\n' "${WIRELESS_EXAMPLE}"
391     elog "${WIRELESS_EXAMPLE} is deprecated and should be removed."
392     fi
393     elog "If you are using the old style network scripts,"
394     elog "Configure wireless settings in ${ROOT}/etc/conf.d/net"
395     elog "after reviewing ${ROOT}/usr/share/doc/${PF}/net.example"
396     fi
397    
398     if [[ -d ${ROOT}/etc/modules.autoload.d ]] ; then
399     ewarn "/etc/modules.autoload.d is no longer used. Please convert"
400     ewarn "your files to /etc/conf.d/modules and delete the directory."
401     fi
402    
403     if use hppa; then
404     elog "Setting the console font does not work on all HPPA consoles."
405     elog "You can still enable it by running:"
406     elog "# rc-update add consolefont boot"
407     fi
408    
409     # Handle the conf.d/local.{start,stop} -> local.d transition
410     if path_exists -o "${ROOT}"etc/conf.d/local.{start,stop} ; then
411     elog "Moving your ${ROOT}etc/conf.d/local.{start,stop}"
412     elog "files to ${ROOT}etc/local.d"
413     mv "${ROOT}"etc/conf.d/local.start "${ROOT}"etc/local.d/baselayout1.start
414     mv "${ROOT}"etc/conf.d/local.stop "${ROOT}"etc/local.d/baselayout1.stop
415     chmod +x "${ROOT}"etc/local.d/*{start,stop}
416     fi
417    
418     # update the dependency tree after touching all files #224171
419     [[ "${ROOT}" = "/" ]] && "${ROOT}/${LIBDIR}"/rc/bin/rc-depend -u
420    
421     elog "You should now update all files in /etc, using etc-update"
422     elog "or equivalent before restarting any services or this host."
423     elog
424     elog "Please read the migration guide available at:"
425     elog "http://www.gentoo.org/doc/en/openrc-migration.xml"
426     }

  ViewVC Help
Powered by ViewVC 1.1.20