--- baselayout-1.12.5/etc/env.d/00basic +++ baselayout-1.12.5/etc/env.d/00basic @@ -1,10 +1,11 @@ -# /etc/env.d/00basic +# @GENTOO_PORTAGE_EPREFIX@/etc/env.d/00basic -PATH="/opt/bin" -ROOTPATH="/opt/bin" -LDPATH="/usr/local/lib" -MANPATH="/usr/local/share/man:/usr/share/man" -INFOPATH="/usr/share/info" +# in prefix we have sbin variants in user path! +PATH="@GENTOO_PORTAGE_EPREFIX@/opt/bin:@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/sbin" +ROOTPATH="@GENTOO_PORTAGE_EPREFIX@/opt/bin" +LDPATH="@GENTOO_PORTAGE_EPREFIX@/usr/local/lib" +MANPATH="@GENTOO_PORTAGE_EPREFIX@/usr/share/man" +INFOPATH="@GENTOO_PORTAGE_EPREFIX@/usr/share/info" CVS_RSH="ssh" -PAGER="/usr/bin/less" +PAGER="@GENTOO_PORTAGE_EPREFIX@/usr/bin/less" LESSOPEN="|lesspipe.sh %s" --- baselayout-1.12.5/sbin/env-update.sh +++ baselayout-1.12.5/sbin/env-update.sh @@ -1,10 +1,10 @@ -#!/bin/bash +#!@GENTOO_PORTAGE_EPREFIX@/bin/bash # Copyright 1999-2004 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -source /sbin/functions.sh || exit 1 +source "@GENTOO_PORTAGE_EPREFIX@"/sbin/functions.sh || exit 1 -if [[ ${EUID} != "0" ]] ; then +if [[ ${EPREFIX/\//} == "" ]] && [[ ${EUID} != "0" ]] ; then eerror "$0: must be root." exit 1 fi @@ -13,8 +13,8 @@ echo "usage: env-update.sh note: - This utility generates /etc/profile.env and /etc/csh.env - from the contents of /etc/env.d/ + This utility generates @GENTOO_PORTAGE_EPREFIX@/etc/profile.env and @GENTOO_PORTAGE_EPREFIX@/etc/csh.env + from the contents of @GENTOO_PORTAGE_EPREFIX@/etc/env.d/ " exit 1 } @@ -30,9 +30,9 @@ if [[ $# != "0" ]] ; then usage else - /bin/gawk \ - -f /lib/rcscripts/awk/functions.awk \ - -f /lib/rcscripts/awk/genenviron.awk + "@GENTOO_PORTAGE_EPREFIX@"/bin/gawk \ + -f "@GENTOO_PORTAGE_EPREFIX@"/lib/rcscripts/awk/functions.awk \ + -f "@GENTOO_PORTAGE_EPREFIX@"/lib/rcscripts/awk/genenviron.awk fi # vim:ts=4 --- baselayout-1.12.5/sbin/functions.sh +++ baselayout-1.12.5/sbin/functions.sh @@ -4,11 +4,11 @@ RC_GOT_FUNCTIONS="yes" # Override defaults with user settings ... -[[ -f /etc/conf.d/rc ]] && source /etc/conf.d/rc +[[ -f @GENTOO_PORTAGE_EPREFIX@/etc/conf.d/rc ]] && source "@GENTOO_PORTAGE_EPREFIX@"/etc/conf.d/rc # Check /etc/conf.d/rc for a description of these ... -declare -r svclib="/lib/rcscripts" -declare -r svcdir="${svcdir:-/var/lib/init.d}" +declare -r svclib="@GENTOO_PORTAGE_EPREFIX@/lib/rcscripts" +declare -r svcdir="${svcdir:-@GENTOO_PORTAGE_EPREFIX@/var/lib/init.d}" svcmount="${svcmount:-no}" svcfstype="${svcfstype:-tmpfs}" svcsize="${svcsize:-1024}" @@ -83,7 +84,7 @@ } # This will override the splash() function... if ! import_addon splash-functions.sh ; then - [[ -f /sbin/splash-functions.sh ]] && source /sbin/splash-functions.sh + [[ -f @GENTOO_PORTAGE_EPREFIX@/sbin/splash-functions.sh ]] && source "@GENTOO_PORTAGE_EPREFIX@"/sbin/splash-functions.sh fi # void profiling(...) @@ -114,8 +115,8 @@ local newbootlevel= local newsoftlevel= - if [[ -r /proc/cmdline ]] ; then - for copt in $(/dev/null } @@ -629,7 +630,7 @@ # EXAMPLE: if is_uml_sys ; then ... # is_uml_sys() { - grep -qs 'UML' /proc/cpuinfo + grep -qs 'UML' "@GENTOO_PORTAGE_EPREFIX@"/proc/cpuinfo } # bool is_vserver_sys() @@ -639,7 +640,7 @@ # EXAMPLE: if is_vserver_sys ; then ... # is_vserver_sys() { - grep -qs '^s_context:[[:space:]]*[1-9]' /proc/self/status + grep -qs '^s_context:[[:space:]]*[1-9]' "@GENTOO_PORTAGE_EPREFIX@"/proc/self/status } # bool is_xenU_sys() @@ -649,9 +650,9 @@ # EXAMPLE: if is_xenU_sys ; then ... # is_xenU_sys() { - [[ ! -d /proc/xen ]] && return 1 - [[ ! -r /proc/xen/capabilities ]] && return 1 - grep -q "control_d" /proc/xen/capabilities && return 1 + [[ ! -d "@GENTOO_PORTAGE_EPREFIX@"/proc/xen ]] && return 1 + [[ ! -r "@GENTOO_PORTAGE_EPREFIX@"/proc/xen/capabilities ]] && return 1 + grep -q "control_d" "@GENTOO_PORTAGE_EPREFIX@"/proc/xen/capabilities && return 1 return 0 } @@ -667,7 +668,7 @@ gawk '$1 ~ "^#" { next } $2 == "'$*'" { stab="-t "$3" -o "$4" "$1" "$2; } END { print stab; } - ' /etc/fstab + ' "@GENTOO_PORTAGE_EPREFIX@"/etc/fstab } # char *reverse_list(list) @@ -771,13 +772,13 @@ # Setup a basic $PATH. Just add system default to existing. # This should solve both /sbin and /usr/sbin not present when # doing 'su -c foo', or for something like: PATH= rcscript start - PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:${PATH}" + PATH="@GENTOO_PORTAGE_EPREFIX@/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/local/sbin:${PATH}" # Cache the CONSOLETYPE - this is important as backgrounded shells don't # have a TTY. rc unsets it at the end of running so it shouldn't hang # around if [[ -z ${CONSOLETYPE} ]] ; then - export CONSOLETYPE="$( /sbin/consoletype 2>/dev/null )" + export CONSOLETYPE="$( "@GENTOO_PORTAGE_EPREFIX@"/sbin/consoletype 2>/dev/null )" fi if [[ ${CONSOLETYPE} == "serial" ]] ; then RC_NOCOLOR="yes" @@ -797,7 +798,7 @@ # If we are not /sbin/rc then ensure that we cannot change level variables if [[ -n ${BASH_SOURCE} \ - && ${BASH_SOURCE[${#BASH_SOURCE[@]}-1]} != "/sbin/rc" ]] ; then + && ${BASH_SOURCE[${#BASH_SOURCE[@]}-1]} != "@GENTOO_PORTAGE_EPREFIX@/sbin/rc" ]] ; then declare -r BOOTLEVEL DEFAULTLEVEL SOFTLEVEL fi else --- baselayout-1.12.5/etc/profile +++ baselayout-1.12.5/etc/profile @@ -1,4 +1,4 @@ -# /etc/profile: login shell setup +# @GENTOO_PORTAGE_EPREFIX@/etc/profile: login shell setup # # That this file is used by any Bourne-shell derivative to setup the # environment for login shells. @@ -6,8 +6,8 @@ # Load environment settings from profile.env, which is created by # env-update from the files in /etc/env.d -if [ -e /etc/profile.env ] ; then - . /etc/profile.env +if [ -e "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env ] ; then + . "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.env fi # 077 would be more secure, but 022 is generally quite realistic @@ -22,23 +22,23 @@ # This way the evaluation can be short-circuited and calling whoami is # avoided. if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then - PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}" + PATH="@GENTOO_PORTAGE_EPREFIX@/usr/sbin:@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/sbin:@GENTOO_PORTAGE_EPREFIX@/bin:${ROOTPATH}:/usr/sbin:/usr/bin:/sbin:/bin" else - PATH="/usr/local/bin:/usr/bin:/bin:${PATH}" + PATH="@GENTOO_PORTAGE_EPREFIX@/usr/bin:@GENTOO_PORTAGE_EPREFIX@/bin:${PATH}:/usr/bin:/bin" fi export PATH unset ROOTPATH # Extract the value of EDITOR -[ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`" -[ -z "$EDITOR" ] && EDITOR="/bin/nano" +[ -z "$EDITOR" ] && EDITOR="`. @GENTOO_PORTAGE_EPREFIX@/etc/rc.conf 2>/dev/null; echo $EDITOR`" +[ -z "$EDITOR" ] && EDITOR="@GENTOO_PORTAGE_EPREFIX@/bin/nano" export EDITOR if [ -n "${BASH_VERSION}" ] ; then # Newer bash ebuilds include /etc/bash/bashrc which will setup PS1 # including color. We leave out color here because not all # terminals support it. - if [ -f /etc/bash/bashrc ] ; then + if [ -f "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc ] ; then # Bash login shells run only /etc/profile # Bash non-login shells run only /etc/bash/bashrc # Since we want to run /etc/bash/bashrc regardless, we source it @@ -46,7 +46,7 @@ # this *after* the user's .bash_profile runs (without putting # it in the user's dot-files), but it shouldn't make any # difference. - . /etc/bash/bashrc + . "@GENTOO_PORTAGE_EPREFIX@"/etc/bash/bashrc else PS1='\u@\h \w \$ ' fi @@ -57,7 +57,7 @@ PS1="`whoami`@`uname -n | cut -f1 -d.` \$ " fi -for sh in /etc/profile.d/*.sh ; do +for sh in "@GENTOO_PORTAGE_EPREFIX@"/etc/profile.d/*.sh ; do if [ -r "$sh" ] ; then . "$sh" fi --- baselayout-1.12.5/sbin/runscript.sh~ 2006-09-14 12:11:34 +0200 +++ baselayout-1.12.5/sbin/runscript.sh 2007-10-06 13:28:40 +0200 @@ -1,18 +1,18 @@ -#!/bin/bash +#!@GENTOO_PORTAGE_EPREFIX@/bin/bash # Copyright 1999-2006 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Common functions -[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source /sbin/functions.sh +[[ ${RC_GOT_FUNCTIONS} != "yes" ]] && source @GENTOO_PORTAGE_EPREFIX@/sbin/functions.sh -# User must be root to run most script stuff (except status) -if [[ ${EUID} != "0" ]] && ! [[ $2 == "status" && $# -eq 2 ]] ; then - eerror "$0: must be root to run init scripts" - exit 1 -fi +## User must be root to run most script stuff (except status) +#if [[ ${EUID} != "0" ]] && ! [[ $2 == "status" && $# -eq 2 ]] ; then +# eerror "$0: must be root to run init scripts" +# exit 1 +#fi myscript="$1" -if [[ -L $1 && ! -L "/etc/init.d/${1##*/}" ]] ; then +if [[ -L $1 && ! -L "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${1##*/}" ]] ; then SVCNAME="$(readlink "$1")" else SVCNAME="$1" @@ -84,12 +84,12 @@ # configuration, if the system administrator chose to put it # there (if it exists). if net_service "${SVCNAME}" ; then - conf="$(add_suffix /etc/conf.d/net)" + conf="$(add_suffix @GENTOO_PORTAGE_EPREFIX@/etc/conf.d/net)" [[ -e ${conf} ]] && source "${conf}" fi -conf="$(add_suffix "/etc/conf.d/${SVCNAME}")" +conf="$(add_suffix "@GENTOO_PORTAGE_EPREFIX@/etc/conf.d/${SVCNAME}")" [[ -e ${conf} ]] && source "${conf}" -conf="$(add_suffix /etc/rc.conf)" +conf="$(add_suffix @GENTOO_PORTAGE_EPREFIX@/etc/rc.conf)" [[ -e ${conf} ]] && source "${conf}" mylevel="${SOFTLEVEL}" @@ -146,7 +146,7 @@ local service="$1" start="$2" [[ ! -d "${svcdir}/scheduled/${service}" ]] \ && mkdir -p "${svcdir}/scheduled/${service}" - ln -snf "/etc/init.d/${service}" \ + ln -snf "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${service}" \ "${svcdir}/scheduled/${service}/${start}" } @@ -334,9 +334,9 @@ if [[ ${retval} == "0" && ${RC_NO_DEPS} != "yes" ]] ; then local startupservices="$(ineed "${SVCNAME}") $(valid_iuse "${SVCNAME}")" local netservices= - for x in $(dolisting "/etc/runlevels/${BOOTLEVEL}/net.*") \ - $(dolisting "/etc/runlevels/${mylevel}/net.*") \ - $(dolisting "/var/lib/init.d/coldplugged/net.*") ; do + for x in $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${BOOTLEVEL}/net.*") \ + $(dolisting "@GENTOO_PORTAGE_EPREFIX@/etc/runlevels/${mylevel}/net.*") \ + $(dolisting "@GENTOO_PORTAGE_EPREFIX@/var/lib/init.d/coldplugged/net.*") ; do netservices="${netservices} ${x##*/}" done @@ -631,9 +631,9 @@ # Simple way to try and detect if the service use svc_{start,stop} # to restart if it have a custom restart() funtion. - if [[ -n $(egrep '^[[:space:]]*restart[[:space:]]*()' "/etc/init.d/${SVCNAME}") ]] ; then - if [[ -z $(egrep 'svc_stop' "/etc/init.d/${SVCNAME}") || \ - -z $(egrep 'svc_start' "/etc/init.d/${SVCNAME}") ]] ; then + if [[ -n $(egrep '^[[:space:]]*restart[[:space:]]*()' "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${SVCNAME}") ]] ; then + if [[ -z $(egrep 'svc_stop' "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${SVCNAME}") || \ + -z $(egrep 'svc_start' "@GENTOO_PORTAGE_EPREFIX@/etc/init.d/${SVCNAME}") ]] ; then echo ewarn "Please use 'svc_stop; svc_start' and not 'stop; start' to" ewarn "restart the service in its custom 'restart()' function."