Move non compiled libraries from /lib/rc to /libexec/rc

OpenRC version is now stored as plaintext in /libexec/rc/version

Plugins (cursplash, splashutils) will have to be re-compiled to pickup
the new directories. State data needs to be moved from /lib/rc/init.d
to /libexec/rc/init.d as well.
This commit is contained in:
Roy Marples 2009-05-23 20:38:12 +01:00
parent 5294abe617
commit c0fd1b49e4
31 changed files with 92 additions and 82 deletions

View File

@ -26,7 +26,9 @@ include ${MK}/sys.mk
include ${MK}/os.mk include ${MK}/os.mk
include ${MK}/subdir.mk include ${MK}/subdir.mk
include ${MK}/dist.mk include ${MK}/dist.mk
include ${MK}/git.mk
_installafter: _installafter:
${INSTALL} -d ${DESTDIR}/${PREFIX}/${RC_LIB}/init.d ${INSTALL} -d ${DESTDIR}/${LIBEXECDIR}/init.d
${INSTALL} -d ${DESTDIR}/${PREFIX}/${RC_LIB}/tmp ${INSTALL} -d ${DESTDIR}/${LIBEXECDIR}/tmp
${ECHO} "${VERSION}${GITVER}" > ${DESTDIR}/${LIBEXECDIR}/version

View File

@ -74,7 +74,7 @@ mkutmp()
start() start()
{ {
# Remove any added console dirs # Remove any added console dirs
rm -rf "$RC_LIBDIR"/console rm -rf "$RC_LIBEXECDIR"/console
local logw=false runw=false local logw=false runw=false
# Ensure that our basic dirs exist # Ensure that our basic dirs exist

View File

@ -52,17 +52,17 @@ start()
eend $retval eend $retval
# Store the last font so we can use it ASAP on boot # Store the last font so we can use it ASAP on boot
if [ $retval -eq 0 -a -w "$RC_LIBDIR" ]; then if [ $retval -eq 0 -a -w "$RC_LIBEXECDIR" ]; then
mkdir -p "$RC_LIBDIR"/console mkdir -p "$RC_LIBEXECDIR"/console
for font in /usr/share/consolefonts/"$consolefont".*; do for font in /usr/share/consolefonts/"$consolefont".*; do
: :
done done
cp "$font" "$RC_LIBDIR"/console cp "$font" "$RC_LIBEXECDIR"/console
echo "${font##*/}" >"$RC_LIBDIR"/console/font echo "${font##*/}" >"$RC_LIBEXECDIR"/console/font
if yesno ${unicode:-${UNICODE}}; then if yesno ${unicode:-${UNICODE}}; then
echo "" > "$RC_LIBDIR"/console/unicode echo "" > "$RC_LIBEXECDIR"/console/unicode
else else
rm -f "$RC_LIBDIR"/console/unicode rm -f "$RC_LIBEXECDIR"/console/unicode
fi fi
fi fi

View File

@ -67,8 +67,8 @@ start()
eend 0 eend 0
# Save the keymapping for use immediately at boot # Save the keymapping for use immediately at boot
if [ -w "$RC_LIBDIR" ]; then if [ -w "$RC_LIBEXECDIR" ]; then
mkdir -p "$RC_LIBDIR"/console mkdir -p "$RC_LIBEXECDIR"/console
dumpkeys >"$RC_LIBDIR"/console/keymap dumpkeys >"$RC_LIBEXECDIR"/console/keymap
fi fi
} }

View File

@ -52,7 +52,7 @@ stop()
# Flush all pending disk writes now # Flush all pending disk writes now
sync; sync sync; sync
. "$RC_LIBDIR"/sh/rc-mount.sh . "$RC_LIBEXECDIR"/sh/rc-mount.sh
# Umount loopback devices # Umount loopback devices
einfo "Unmounting loopback devices" einfo "Unmounting loopback devices"

View File

@ -17,7 +17,7 @@ start()
ebegin "Remounting remaining filesystems read-only" ebegin "Remounting remaining filesystems read-only"
# We need the do_unmount function # We need the do_unmount function
. "$RC_LIBDIR"/sh/rc-mount.sh . "$RC_LIBEXECDIR"/sh/rc-mount.sh
eindent eindent
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs= local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
m="$m|/bin|/sbin|/lib|/libexec" m="$m|/bin|/sbin|/lib|/libexec"

View File

@ -2,7 +2,7 @@
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> # Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
MODULESDIR="${RC_LIBDIR}/net" MODULESDIR="${RC_LIBEXECDIR}/net"
MODULESLIST="${RC_SVCDIR}/nettree" MODULESLIST="${RC_SVCDIR}/nettree"
_config_vars="config routes" _config_vars="config routes"

View File

@ -74,7 +74,7 @@ stop()
local x= fs= local x= fs=
ebegin "Unmounting network filesystems" ebegin "Unmounting network filesystems"
. "$RC_LIBDIR"/sh/rc-mount.sh . "$RC_LIBEXECDIR"/sh/rc-mount.sh
for x in $net_fs_list; do for x in $net_fs_list; do
fs="$fs${fs:+,}$x" fs="$fs${fs:+,}$x"

View File

@ -14,9 +14,9 @@ start()
fi fi
fi fi
ebegin "Saving dependency cache" ebegin "Saving dependency cache"
if [ ! -d "$RC_LIBDIR"/cache ]; then if [ ! -d "$RC_LIBEXECDIR"/cache ]; then
rm -rf "$RC_LIBDIR"/cache rm -rf "$RC_LIBEXECDIR"/cache
if ! mkdir "$RC_LIBDIR"/cache; then if ! mkdir "$RC_LIBEXECDIR"/cache; then
eend $? eend $?
return $? return $?
fi fi
@ -26,7 +26,7 @@ start()
[ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x" [ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x"
done done
if [ -n "$save" ]; then if [ -n "$save" ]; then
cp -p $save "$RC_LIBDIR"/cache 2>/dev/null cp -p $save "$RC_LIBEXECDIR"/cache 2>/dev/null
fi fi
eend $? eend $?
} }

8
mk/git.mk Normal file
View File

@ -0,0 +1,8 @@
_GITVER_SH= if git rev-parse --short HEAD >/dev/null 2>&1; then \
printf "."; \
git rev-parse --short HEAD; \
else \
echo ""; \
fi
_GITVER!= ${_GITVER_SH}
GITVER= ${_GITVER}$(shell ${_GITVER_SH})

View File

@ -12,7 +12,7 @@ _PKG_SED!= ${_PKG_SED_SH}
_LCL_SED_SH= if test "${PREFIX}" = "${LOCAL_PREFIX}"; then echo "-e 's:@LOCAL_PREFIX@::g'"; else echo "-e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'"; fi _LCL_SED_SH= if test "${PREFIX}" = "${LOCAL_PREFIX}"; then echo "-e 's:@LOCAL_PREFIX@::g'"; else echo "-e 's:@LOCAL_PREFIX@:${LOCAL_PREFIX}:g'"; fi
_LCL_SED!= ${_LCL_SED_SH} _LCL_SED!= ${_LCL_SED_SH}
SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' ${_PKG_SED}$(shell ${_PKG_SED_SH}) ${_LCL_SED}$(shell ${_LCL_SED_SH}) SED_REPLACE= -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g' -e 's:@PREFIX@:${PREFIX}:g' ${_PKG_SED}$(shell ${_PKG_SED_SH}) ${_LCL_SED}$(shell ${_LCL_SED_SH})
# Tweak our shell scripts # Tweak our shell scripts
.SUFFIXES: .sh.in .in .SUFFIXES: .sh.in .in

View File

@ -35,6 +35,8 @@ LIBDIR?= ${UPREFIX}/${LIBNAME}
LIBMODE?= 0444 LIBMODE?= 0444
SHLIBDIR?= ${PREFIX}/${LIBNAME} SHLIBDIR?= ${PREFIX}/${LIBNAME}
LIBEXECDIR?= ${PREFIX}/libexec/rc
MANPREFIX?= ${UPREFIX}/share MANPREFIX?= ${UPREFIX}/share
MANDIR?= ${MANPREFIX}/man MANDIR?= ${MANPREFIX}/man
MANMODE?= 0444 MANMODE?= 0444

View File

@ -1,4 +1,4 @@
DIR= ${PREFIX}/${RC_LIB}/net DIR= ${LIBEXECDIR}/net
SRCS= ifconfig.sh.in SRCS= ifconfig.sh.in
INC= dhclient.sh dhcpcd.sh ifconfig.sh macchanger.sh macnet.sh \ INC= dhclient.sh dhcpcd.sh ifconfig.sh macchanger.sh macnet.sh \
ssidnet.sh system.sh wpa_supplicant.sh ssidnet.sh system.sh wpa_supplicant.sh

View File

@ -33,8 +33,8 @@ ifwatchd_pre_start()
# Start ifwatchd # Start ifwatchd
export IN_BACKGROUND=yes export IN_BACKGROUND=yes
start-stop-daemon --start --exec /usr/sbin/ifwatchd \ start-stop-daemon --start --exec /usr/sbin/ifwatchd \
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \ -- -c "${RC_LIBEXECDIR}/sh/ifwatchd-carrier.sh" \
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" -n "${RC_LIBEXECDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}"
unset IN_BACKGROUND unset IN_BACKGROUND
eend "$?" || return 1 eend "$?" || return 1
@ -47,13 +47,13 @@ ifwatchd_stop()
yesno ${IN_BACKGROUND} && return 0 yesno ${IN_BACKGROUND} && return 0
start-stop-daemon --test --quiet --stop --exec /usr/sbin/ifwatchd \ start-stop-daemon --test --quiet --stop --exec /usr/sbin/ifwatchd \
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \ -- -c "${RC_LIBEXECDIR}/sh/ifwatchd-carrier.sh" \
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" \ -n "${RC_LIBEXECDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" \
|| return 0 || return 0
ebegin "Stopping ifwatchd on" "${IFACE}" ebegin "Stopping ifwatchd on" "${IFACE}"
start-stop-daemon --stop --exec /usr/sbin/ifwatchd \ start-stop-daemon --stop --exec /usr/sbin/ifwatchd \
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \ -- -c "${RC_LIBEXECDIR}/sh/ifwatchd-carrier.sh" \
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" -n "${RC_LIBEXECDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}"
eend $? eend $?
} }

View File

@ -68,7 +68,7 @@ udhcpc_start()
;; ;;
esac esac
local script="${RC_LIBDIR}"/sh/udhcpc.sh local script="${RC_LIBEXECDIR}"/sh/udhcpc.h
[ -x "${script}" ] || script=/lib/rcscripts/sh/udhcpc.sh [ -x "${script}" ] || script=/lib/rcscripts/sh/udhcpc.sh
eval "${x}" "${args}" --interface="${IFACE}" --now \ eval "${x}" "${args}" --interface="${IFACE}" --now \

View File

@ -1,4 +1,4 @@
DIR= ${PREFIX}/${RC_LIB}/sh DIR= ${LIBEXECDIR}/sh
SRCS= functions.sh.in gendepends.sh.in init-common-post.sh.in \ SRCS= functions.sh.in gendepends.sh.in init-common-post.sh.in \
rc-functions.sh.in runscript.sh.in rc-functions.sh.in runscript.sh.in
INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
@ -13,9 +13,8 @@ include ${MK}/scripts.mk
_installafter: _installafter:
${INSTALL} -d ${DESTDIR}/${INITDIR} ${INSTALL} -d ${DESTDIR}/${INITDIR}
@# Put functions.sh into the init.d dir so 3rd party apps don't have to @# Put functions.sh into init for backwards compat
@# be multilib aware ln -snf ${LIBEXECDIR}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
check test:: check test::
./runtests.sh ./runtests.sh

View File

@ -47,7 +47,7 @@ _sanitize_path()
local IFS=":" p= path= local IFS=":" p= path=
for p in $PATH; do for p in $PATH; do
case "$p" in case "$p" in
@PREFIX@/@LIB@/rc/bin|@PREFIX@/@LIB@/rc/sbin);; @LIBEXECDIR@/bin|@LIBEXECDIR@/sbin);;
@PREFIX@/bin|@PREFIX@/sbin|/usr/bin|/usr/sbin);; @PREFIX@/bin|@PREFIX@/sbin|/usr/bin|/usr/sbin);;
@PKG_PREFIX@/bin|@PKG_PREFIX@/sbin);; @PKG_PREFIX@/bin|@PKG_PREFIX@/sbin);;
@LOCAL_PREFIX@/bin|@LOCAL_PREFIX@/sbin);; @LOCAL_PREFIX@/bin|@LOCAL_PREFIX@/sbin);;
@ -70,7 +70,7 @@ _PREFIX=@PREFIX@
_PKG_PREFIX=@PKG_PREFIX@ _PKG_PREFIX=@PKG_PREFIX@
_LOCAL_PREFIX=@LOCAL_PREFIX@ _LOCAL_PREFIX=@LOCAL_PREFIX@
_LOCAL_PREFIX=${_LOCAL_PREFIX:-/usr/local} _LOCAL_PREFIX=${_LOCAL_PREFIX:-/usr/local}
_PATH=@PREFIX@/@LIB@/rc/bin _PATH=@LIBEXECDIR@/bin
case "$_PREFIX" in case "$_PREFIX" in
"$_PKG_PREFIX"|"$_LOCAL_PREFIX") ;; "$_PKG_PREFIX"|"$_LOCAL_PREFIX") ;;
*) _PATH="$_PATH:$_PREFIX/bin:$_PREFIX/sbin";; *) _PATH="$_PATH:$_PREFIX/bin:$_PREFIX/sbin";;
@ -104,7 +104,7 @@ else
# the last ecmd # the last ecmd
for _e in ebegin eend error errorn einfo einfon ewarn ewarnn ewend \ for _e in ebegin eend error errorn einfo einfon ewarn ewarnn ewend \
vebegin veend veinfo vewarn vewend; do vebegin veend veinfo vewarn vewend; do
eval "$_e() { local _r; @PREFIX@/@LIB@/rc/bin/$_e \"\$@\"; _r=$?; \ eval "$_e() { local _r; @LIBEXECDIR@/bin/$_e \"\$@\"; _r=$?; \
export EINFO_LASTCMD=$_e; return \$_r; }" export EINFO_LASTCMD=$_e; return \$_r; }"
done done
unset _e unset _e

View File

@ -1,10 +1,11 @@
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name> # Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
# mount $RC_SVCDIR as something we can write to if it's not rw # mount $RC_SVCDIR as something we can write to if it's not rw
# On vservers, / is always rw at this point, so we need to clean out # On vservers, / is always rw at this point, so we need to clean out
# the old service state data # the old service state data
: ${RC_SVCDIR:=/@LIB@/rc/init.d} : ${RC_LIBEXECDIR:=@LIBEXECDIR@}
: ${RC_SVCDIR:=@LIBEXECDIR@/init.d}
case "$(rc --sys)" in case "$(rc --sys)" in
OPENVZ|VSERVER) rm -rf "$RC_SVCDIR"/*;; OPENVZ|VSERVER) rm -rf "$RC_SVCDIR"/*;;
*) if mountinfo --quiet "$RC_SVCDIR"; then *) if mountinfo --quiet "$RC_SVCDIR"; then
@ -16,8 +17,8 @@ case "$(rc --sys)" in
esac esac
retval=$? retval=$?
if [ -e "$RC_LIBDIR"/cache/deptree ]; then if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
cp -p "$RC_LIBDIR"/cache/* "$RC_SVCDIR" 2>/dev/null cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
fi fi
echo sysinit >"$RC_SVCDIR"/softlevel echo sysinit >"$RC_SVCDIR"/softlevel

View File

@ -3,8 +3,9 @@
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
: ${CONSOLE:=/dev/console} : ${CONSOLE:=/dev/console}
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
if [ -e "$RC_LIBDIR"/console/unicode ]; then if [ -e "$RC_LIBEXECDIR"/console/unicode ]; then
termencoding="%G" termencoding="%G"
kmode="-u" kmode="-u"
else else
@ -16,10 +17,10 @@ fi
if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/consolefont \ if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/consolefont \
-o -e /etc/runlevels/"$RC_BOOTLEVEL"/consolefont ]; then -o -e /etc/runlevels/"$RC_BOOTLEVEL"/consolefont ]; then
printf "\033%s" "$termencoding" >"$CONSOLE" 2>/dev/null printf "\033%s" "$termencoding" >"$CONSOLE" 2>/dev/null
if [ -r "$RC_LIBDIR"/console/font -a -x /bin/setfont ]; then if [ -r "$RC_LIBEXECDIR"/console/font -a -x /bin/setfont ]; then
font="$(cat "$RC_LIBDIR"/console/font)" font="$(cat "$RC_LIBEXECDIR"/console/font)"
[ -c "$CONSOLE" ] && cons="-C $CONSOLE" [ -c "$CONSOLE" ] && cons="-C $CONSOLE"
setfont $cons "$RC_LIBDIR"/console/"$font" 2>/dev/null setfont $cons "$RC_LIBEXECDIR"/console/"$font" 2>/dev/null
fi fi
fi fi
@ -27,8 +28,8 @@ fi
if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/keymaps \ if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/keymaps \
-o -e /etc/runlevels/"$RC_BOOTLEVEL"/keymaps ]; then -o -e /etc/runlevels/"$RC_BOOTLEVEL"/keymaps ]; then
kbd_mode $kmode -C "$CONSOLE" 2>/dev/null kbd_mode $kmode -C "$CONSOLE" 2>/dev/null
if [ -r "$RC_LIBDIR"/console/keymap ]; then if [ -r "$RC_LIBEXECDIR"/console/keymap ]; then
loadkeys "$RC_LIBDIR"/console/keymap 2>/dev/null loadkeys "$RC_LIBEXECDIR"/console/keymap 2>/dev/null
fi fi
fi fi

View File

@ -21,7 +21,7 @@ mount_svcdir()
fi fi
} }
. "$RC_LIBDIR"/sh/functions.sh . "$RC_LIBEXECDIR"/sh/functions.sh
[ -r /etc/rc.conf ] && . /etc/rc.conf [ -r /etc/rc.conf ] && . /etc/rc.conf
# Disable devd until we need it # Disable devd until we need it
@ -29,4 +29,4 @@ if [ -z "$RC_SYS" -a "$RC_UNAME" = "FreeBSD" ]; then
sysctl hw.bus.devctl_disable=1 >/dev/null sysctl hw.bus.devctl_disable=1 >/dev/null
fi fi
. "$RC_LIBDIR"/sh/init-common-post.sh . "$RC_LIBEXECDIR"/sh/init-common-post.sh

View File

@ -38,7 +38,7 @@ mount_svcdir()
fi fi
} }
. /etc/init.d/functions.sh . "$RC_LIBEXECDIR"/sh/functions.sh
[ -r /etc/rc.conf ] && . /etc/rc.conf [ -r /etc/rc.conf ] && . /etc/rc.conf
# By default VServer already has /proc mounted, but OpenVZ does not! # By default VServer already has /proc mounted, but OpenVZ does not!
@ -68,4 +68,4 @@ if $mountproc; then
eend $? eend $?
fi fi
. "$RC_LIBDIR"/sh/init-common-post.sh . "$RC_LIBEXECDIR"/sh/init-common-post.sh

View File

@ -4,7 +4,7 @@
has_addon() has_addon()
{ {
[ -e "$RC_LIBDIR/addons/$1.sh" -o -e /@LIB@/rcscripts/addons/"$1".sh ] [ -e /@LIB@/rc/addons/"$1".sh -o -e /@LIB@/rcscripts/addons/"$1".sh ]
} }
_addon_warn() _addon_warn()
@ -17,9 +17,9 @@ _addon_warn()
import_addon() import_addon()
{ {
if [ -e "$RC_LIBDIR/addons/$1.sh" ]; then if [ -e /@LIB@/rc/addons/"$1".sh ]; then
_addon_warn _addon_warn
. "$RC_LIBDIR/addons/$1.sh" . /@LIB@/rc/addons/"$1".sh
elif [ -e /@LIB@/rcscripts/addons/"$1".sh ]; then elif [ -e /@LIB@/rcscripts/addons/"$1".sh ]; then
_addon_warn _addon_warn
. /@LIB@/rcscripts/addons/"$1".sh . /@LIB@/rcscripts/addons/"$1".sh
@ -86,6 +86,6 @@ get_bootparam()
# Add our sbin to $PATH # Add our sbin to $PATH
case "$PATH" in case "$PATH" in
"$RC_LIBDIR"/sbin|"$RC_LIBDIR"/sbin:*);; "$RC_LIBEXECDIR"/sbin|"$RC_LIBEXECDIR"/sbin:*);;
*) export PATH="$RC_LIBDIR/sbin:$PATH";; *) export PATH="$RC_LIBEXECDIR/sbin:$PATH";;
esac esac

View File

@ -5,7 +5,7 @@
# All rights reserved. Released under the 2-clause BSD license. # All rights reserved. Released under the 2-clause BSD license.
. @SYSCONFDIR@/init.d/functions.sh . @SYSCONFDIR@/init.d/functions.sh
. "$RC_LIBDIR"/sh/rc-functions.sh . @LIBEXECDIR@/sh/rc-functions.sh
# Support LiveCD foo # Support LiveCD foo
if [ -r /sbin/livecd-functions.sh ]; then if [ -r /sbin/livecd-functions.sh ]; then

View File

@ -18,6 +18,7 @@ include ${MK}/debug.mk
SED_CMD= -e 's:@PREFIX@:${PREFIX}:g' SED_CMD= -e 's:@PREFIX@:${PREFIX}:g'
SED_CMD+= -e 's:@LIB@:${LIBNAME}:g' SED_CMD+= -e 's:@LIB@:${LIBNAME}:g'
SED_CMD+= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g' SED_CMD+= -e 's:@SYSCONFDIR@:${SYSCONFDIR}:g'
SED_CMD+= -e 's:@LIBEXECDIR@:${LIBEXECDIR}:g'
_PKG_PREFIX_SH= if test -n "${PKG_PREFIX}" && test "${PKG_PREFIX}" != "/" && test "${PKG_PREFIX}" != "${PREFIX}"; then \ _PKG_PREFIX_SH= if test -n "${PKG_PREFIX}" && test "${PKG_PREFIX}" != "/" && test "${PKG_PREFIX}" != "${PREFIX}"; then \
echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; \ echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; \
else \ else \

View File

@ -31,7 +31,7 @@
#include "librc.h" #include "librc.h"
#define GENDEP RC_LIBDIR "/sh/gendepends.sh" #define GENDEP RC_LIBEXECDIR "/sh/gendepends.sh"
#define RC_DEPCONFIG RC_SVCDIR "/depconfig" #define RC_DEPCONFIG RC_SVCDIR "/depconfig"
@ -647,6 +647,7 @@ static const DEPPAIR deppairs[] = {
static const char *const depdirs[] = static const char *const depdirs[] =
{ {
RC_SVCDIR,
RC_SVCDIR "/starting", RC_SVCDIR "/starting",
RC_SVCDIR "/started", RC_SVCDIR "/started",
RC_SVCDIR "/stopping", RC_SVCDIR "/stopping",
@ -742,10 +743,10 @@ rc_deptree_update(void)
bool retval = true; bool retval = true;
const char *sys = rc_sys(); const char *sys = rc_sys();
/* Some init scripts need RC_LIBDIR to source stuff /* Some init scripts need RC_LIBEXECDIR to source stuff
Ideally we should be setting our full env instead */ Ideally we should be setting our full env instead */
if (!getenv("RC_LIBDIR")) if (!getenv("RC_LIBEXECDIR"))
setenv("RC_LIBDIR", RC_LIBDIR, 0); setenv("RC_LIBEXECDIR", RC_LIBEXECDIR, 0);
/* Phase 1 - source all init scripts and print dependencies */ /* Phase 1 - source all init scripts and print dependencies */
if (!(fp = popen(GENDEP, "r"))) if (!(fp = popen(GENDEP, "r")))

View File

@ -36,11 +36,12 @@ __BEGIN_DECLS
#define RC_SYSCONFDIR "@SYSCONFDIR@" #define RC_SYSCONFDIR "@SYSCONFDIR@"
#define RC_LIBDIR "@PREFIX@/@LIB@/rc" #define RC_LIBDIR "@PREFIX@/@LIB@/rc"
#define RC_SVCDIR RC_LIBDIR "/init.d" #define RC_LIBEXECDIR "@LIBEXECDIR@"
#define RC_PLUGINDIR RC_LIBDIR "/plugins" #define RC_SVCDIR RC_LIBEXECDIR "/init.d"
#define RC_RUNLEVELDIR RC_SYSCONFDIR "/runlevels" #define RC_RUNLEVELDIR RC_SYSCONFDIR "/runlevels"
#define RC_INITDIR RC_SYSCONFDIR "/init.d" #define RC_INITDIR RC_SYSCONFDIR "/init.d"
#define RC_CONFDIR RC_SYSCONFDIR "/conf.d" #define RC_CONFDIR RC_SYSCONFDIR "/conf.d"
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
/* PKG_PREFIX is where packages are installed if different from the base OS /* PKG_PREFIX is where packages are installed if different from the base OS
* On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD * On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD

View File

@ -8,7 +8,7 @@ CLEANFILES= version.h
BINDIR= ${PREFIX}/bin BINDIR= ${PREFIX}/bin
SBINDIR= ${PREFIX}/sbin SBINDIR= ${PREFIX}/sbin
LINKDIR= ${PREFIX}/${LIBNAME}/${PROG} LINKDIR= ${LIBEXECDIR}
BINLINKS= rc-status BINLINKS= rc-status
SBINLINKS= rc-service rc-update runscript start-stop-daemon SBINLINKS= rc-service rc-update runscript start-stop-daemon
@ -37,21 +37,13 @@ LDADD+= -lutil -lrc -leinfo
MK= ../../mk MK= ../../mk
include ${MK}/debug.mk include ${MK}/debug.mk
include ${MK}/prog.mk include ${MK}/prog.mk
include ${MK}/git.mk
include ${MK}/cc.mk include ${MK}/cc.mk
include ${MK}/${MKTERMCAP}.mk include ${MK}/${MKTERMCAP}.mk
LDADD+= ${LIBDL} ${LIBKVM} LDADD+= ${LIBDL} ${LIBKVM}
include ${MK}/${MKPAM}.mk include ${MK}/${MKPAM}.mk
_GITVER_SH= if git rev-parse --short HEAD >/dev/null 2>&1; then \
printf "."; \
git rev-parse --short HEAD; \
else \
echo ""; \
fi
_GITVER!= ${_GITVER_SH}
GITVER= ${_GITVER}$(shell ${_GITVER_SH})
${SRCS}: version.h ${SRCS}: version.h
version.h: version.h:
sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h

View File

@ -50,14 +50,15 @@
#include "einfo.h" #include "einfo.h"
#include "rc.h" #include "rc.h"
#include "rc-misc.h" #include "rc-misc.h"
#include "version.h"
#define PROFILE_ENV RC_SYSCONFDIR "/profile.env" #define PROFILE_ENV RC_SYSCONFDIR "/profile.env"
#define SYS_WHITELIST RC_LIBDIR "/conf.d/env_whitelist" #define SYS_WHITELIST RC_LIBEXECDIR "/conf.d/env_whitelist"
#define USR_WHITELIST RC_SYSCONFDIR "/conf.d/env_whitelist" #define USR_WHITELIST RC_SYSCONFDIR "/conf.d/env_whitelist"
#define RC_CONF RC_SYSCONFDIR "/rc.conf" #define RC_CONF RC_SYSCONFDIR "/rc.conf"
#define RC_CONF_OLD RC_SYSCONFDIR "/conf.d/rc" #define RC_CONF_OLD RC_SYSCONFDIR "/conf.d/rc"
#define PATH_PREFIX RC_LIBDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin" #define PATH_PREFIX RC_LIBEXECDIR "/bin:/bin:/sbin:/usr/bin:/usr/sbin"
static RC_STRINGLIST *rc_conf = NULL; static RC_STRINGLIST *rc_conf = NULL;
@ -221,7 +222,8 @@ env_config(void)
free(e); free(e);
} }
setenv("RC_LIBDIR", RC_LIBDIR, 1); setenv("RC_VERSION", VERSION, 1);
setenv("RC_LIBEXECDIR", RC_LIBEXECDIR, 1);
setenv("RC_SVCDIR", RC_SVCDIR, 1); setenv("RC_SVCDIR", RC_SVCDIR, 1);
setenv("RC_TMPDIR", RC_SVCDIR "/tmp", 1); setenv("RC_TMPDIR", RC_SVCDIR "/tmp", 1);
setenv("RC_BOOTLEVEL", RC_LEVEL_BOOT, 1); setenv("RC_BOOTLEVEL", RC_LEVEL_BOOT, 1);

View File

@ -72,8 +72,8 @@ const char rc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
#include "version.h" #include "version.h"
#define INITSH RC_LIBDIR "/sh/init.sh" #define INITSH RC_LIBEXECDIR "/sh/init.sh"
#define INITEARLYSH RC_LIBDIR "/sh/init-early.sh" #define INITEARLYSH RC_LIBEXECDIR "/sh/init-early.sh"
#define SHUTDOWN "/sbin/shutdown" #define SHUTDOWN "/sbin/shutdown"
#define SULOGIN "/sbin/sulogin" #define SULOGIN "/sbin/sulogin"

View File

@ -398,10 +398,10 @@ svc_exec(const char *arg1, const char *arg2)
service, strerror(errno)); service, strerror(errno));
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} else { } else {
execl(RC_LIBDIR "/sh/runscript.sh", execl(RC_LIBEXECDIR "/sh/runscript.sh",
RC_LIBDIR "/sh/runscript.sh", RC_LIBEXECDIR "/sh/runscript.sh",
service, arg1, arg2, (char *) NULL); service, arg1, arg2, (char *) NULL);
eerror("%s: exec `" RC_LIBDIR "/sh/runscript.sh': %s", eerror("%s: exec `" RC_LIBEXECDIR "/sh/runscript.sh': %s",
service, strerror(errno)); service, strerror(errno));
_exit(EXIT_FAILURE); _exit(EXIT_FAILURE);
} }

View File

@ -1188,8 +1188,8 @@ start_stop_daemon(int argc, char **argv)
while (*p == ':') while (*p == ':')
p++; p++;
} }
if (strcmp(token, RC_LIBDIR "/bin") != 0 && if (strcmp(token, RC_LIBEXECDIR "/bin") != 0 &&
strcmp(token, RC_LIBDIR "/sbin") != 0) strcmp(token, RC_LIBEXECDIR "/sbin") != 0)
{ {
len = strlen(token); len = strlen(token);
if (np != newpath) if (np != newpath)