Merge branch 'master' of ssh://roy.marples.name/var/git/openrc
This commit is contained in:
commit
83e82c452e
6
Makefile
6
Makefile
@ -26,7 +26,9 @@ include ${MK}/sys.mk
|
||||
include ${MK}/os.mk
|
||||
include ${MK}/subdir.mk
|
||||
include ${MK}/dist.mk
|
||||
include ${MK}/git.mk
|
||||
|
||||
_installafter:
|
||||
${INSTALL} -d ${DESTDIR}/${PREFIX}/${RC_LIB}/init.d
|
||||
${INSTALL} -d ${DESTDIR}/${PREFIX}/${RC_LIB}/tmp
|
||||
${INSTALL} -d ${DESTDIR}/${LIBEXECDIR}/init.d
|
||||
${INSTALL} -d ${DESTDIR}/${LIBEXECDIR}/tmp
|
||||
${ECHO} "${VERSION}${GITVER}" > ${DESTDIR}/${LIBEXECDIR}/version
|
||||
|
@ -74,7 +74,7 @@ mkutmp()
|
||||
start()
|
||||
{
|
||||
# Remove any added console dirs
|
||||
rm -rf "$RC_LIBDIR"/console
|
||||
rm -rf "$RC_LIBEXECDIR"/console
|
||||
|
||||
local logw=false runw=false
|
||||
# Ensure that our basic dirs exist
|
||||
|
@ -52,17 +52,17 @@ start()
|
||||
eend $retval
|
||||
|
||||
# Store the last font so we can use it ASAP on boot
|
||||
if [ $retval -eq 0 -a -w "$RC_LIBDIR" ]; then
|
||||
mkdir -p "$RC_LIBDIR"/console
|
||||
if [ $retval -eq 0 -a -w "$RC_LIBEXECDIR" ]; then
|
||||
mkdir -p "$RC_LIBEXECDIR"/console
|
||||
for font in /usr/share/consolefonts/"$consolefont".*; do
|
||||
:
|
||||
done
|
||||
cp "$font" "$RC_LIBDIR"/console
|
||||
echo "${font##*/}" >"$RC_LIBDIR"/console/font
|
||||
cp "$font" "$RC_LIBEXECDIR"/console
|
||||
echo "${font##*/}" >"$RC_LIBEXECDIR"/console/font
|
||||
if yesno ${unicode:-${UNICODE}}; then
|
||||
echo "" > "$RC_LIBDIR"/console/unicode
|
||||
echo "" > "$RC_LIBEXECDIR"/console/unicode
|
||||
else
|
||||
rm -f "$RC_LIBDIR"/console/unicode
|
||||
rm -f "$RC_LIBEXECDIR"/console/unicode
|
||||
fi
|
||||
|
||||
fi
|
||||
|
@ -67,8 +67,8 @@ start()
|
||||
eend 0
|
||||
|
||||
# Save the keymapping for use immediately at boot
|
||||
if [ -w "$RC_LIBDIR" ]; then
|
||||
mkdir -p "$RC_LIBDIR"/console
|
||||
dumpkeys >"$RC_LIBDIR"/console/keymap
|
||||
if [ -w "$RC_LIBEXECDIR" ]; then
|
||||
mkdir -p "$RC_LIBEXECDIR"/console
|
||||
dumpkeys >"$RC_LIBEXECDIR"/console/keymap
|
||||
fi
|
||||
}
|
||||
|
@ -52,7 +52,7 @@ stop()
|
||||
# Flush all pending disk writes now
|
||||
sync; sync
|
||||
|
||||
. "$RC_LIBDIR"/sh/rc-mount.sh
|
||||
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
||||
|
||||
# Umount loopback devices
|
||||
einfo "Unmounting loopback devices"
|
||||
|
@ -17,7 +17,7 @@ start()
|
||||
|
||||
ebegin "Remounting remaining filesystems read-only"
|
||||
# We need the do_unmount function
|
||||
. "$RC_LIBDIR"/sh/rc-mount.sh
|
||||
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
||||
eindent
|
||||
local m="/dev|/dev/.*|/proc|/proc.*|/sys|/sys/.*|${RC_SVCDIR}" x= fs=
|
||||
m="$m|/bin|/sbin|/lib|/libexec"
|
||||
|
@ -2,7 +2,7 @@
|
||||
# Copyright (c) 2007-2008 Roy Marples <roy@marples.name>
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
MODULESDIR="${RC_LIBDIR}/net"
|
||||
MODULESDIR="${RC_LIBEXECDIR}/net"
|
||||
MODULESLIST="${RC_SVCDIR}/nettree"
|
||||
_config_vars="config routes"
|
||||
|
||||
|
@ -74,7 +74,7 @@ stop()
|
||||
local x= fs=
|
||||
|
||||
ebegin "Unmounting network filesystems"
|
||||
. "$RC_LIBDIR"/sh/rc-mount.sh
|
||||
. "$RC_LIBEXECDIR"/sh/rc-mount.sh
|
||||
|
||||
for x in $net_fs_list; do
|
||||
fs="$fs${fs:+,}$x"
|
||||
|
@ -14,9 +14,9 @@ start()
|
||||
fi
|
||||
fi
|
||||
ebegin "Saving dependency cache"
|
||||
if [ ! -d "$RC_LIBDIR"/cache ]; then
|
||||
rm -rf "$RC_LIBDIR"/cache
|
||||
if ! mkdir "$RC_LIBDIR"/cache; then
|
||||
if [ ! -d "$RC_LIBEXECDIR"/cache ]; then
|
||||
rm -rf "$RC_LIBEXECDIR"/cache
|
||||
if ! mkdir "$RC_LIBEXECDIR"/cache; then
|
||||
eend $?
|
||||
return $?
|
||||
fi
|
||||
@ -26,7 +26,7 @@ start()
|
||||
[ -e "$RC_SVCDIR/$x" ] && save="$save $RC_SVCDIR/$x"
|
||||
done
|
||||
if [ -n "$save" ]; then
|
||||
cp -p $save "$RC_LIBDIR"/cache 2>/dev/null
|
||||
cp -p $save "$RC_LIBEXECDIR"/cache 2>/dev/null
|
||||
fi
|
||||
eend $?
|
||||
}
|
||||
|
8
mk/git.mk
Normal file
8
mk/git.mk
Normal 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})
|
@ -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!= ${_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
|
||||
.SUFFIXES: .sh.in .in
|
||||
|
@ -35,6 +35,8 @@ LIBDIR?= ${UPREFIX}/${LIBNAME}
|
||||
LIBMODE?= 0444
|
||||
SHLIBDIR?= ${PREFIX}/${LIBNAME}
|
||||
|
||||
LIBEXECDIR?= ${PREFIX}/libexec/rc
|
||||
|
||||
MANPREFIX?= ${UPREFIX}/share
|
||||
MANDIR?= ${MANPREFIX}/man
|
||||
MANMODE?= 0444
|
||||
|
2
net/.gitignore
vendored
Normal file
2
net/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
ifconfig.sh
|
||||
iwconfig.sh
|
@ -1,4 +1,4 @@
|
||||
DIR= ${PREFIX}/${RC_LIB}/net
|
||||
DIR= ${LIBEXECDIR}/net
|
||||
SRCS= ifconfig.sh.in
|
||||
INC= dhclient.sh dhcpcd.sh ifconfig.sh macchanger.sh macnet.sh \
|
||||
ssidnet.sh system.sh wpa_supplicant.sh
|
||||
|
@ -33,8 +33,8 @@ ifwatchd_pre_start()
|
||||
# Start ifwatchd
|
||||
export IN_BACKGROUND=yes
|
||||
start-stop-daemon --start --exec /usr/sbin/ifwatchd \
|
||||
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \
|
||||
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}"
|
||||
-- -c "${RC_LIBEXECDIR}/sh/ifwatchd-carrier.sh" \
|
||||
-n "${RC_LIBEXECDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}"
|
||||
unset IN_BACKGROUND
|
||||
eend "$?" || return 1
|
||||
|
||||
@ -47,13 +47,13 @@ ifwatchd_stop()
|
||||
yesno ${IN_BACKGROUND} && return 0
|
||||
|
||||
start-stop-daemon --test --quiet --stop --exec /usr/sbin/ifwatchd \
|
||||
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \
|
||||
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" \
|
||||
-- -c "${RC_LIBEXECDIR}/sh/ifwatchd-carrier.sh" \
|
||||
-n "${RC_LIBEXECDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}" \
|
||||
|| return 0
|
||||
|
||||
ebegin "Stopping ifwatchd on" "${IFACE}"
|
||||
start-stop-daemon --stop --exec /usr/sbin/ifwatchd \
|
||||
-- -c "${RC_LIBDIR}/sh/ifwatchd-carrier.sh" \
|
||||
-n "${RC_LIBDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}"
|
||||
-- -c "${RC_LIBEXECDIR}/sh/ifwatchd-carrier.sh" \
|
||||
-n "${RC_LIBEXECDIR}/sh/ifwatchd-nocarrier.sh" "${IFACE}"
|
||||
eend $?
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ udhcpc_start()
|
||||
;;
|
||||
esac
|
||||
|
||||
local script="${RC_LIBDIR}"/sh/udhcpc.sh
|
||||
local script="${RC_LIBEXECDIR}"/sh/udhcpc.h
|
||||
[ -x "${script}" ] || script=/lib/rcscripts/sh/udhcpc.sh
|
||||
|
||||
eval "${x}" "${args}" --interface="${IFACE}" --now \
|
||||
|
@ -1,4 +1,4 @@
|
||||
DIR= ${PREFIX}/${RC_LIB}/sh
|
||||
DIR= ${LIBEXECDIR}/sh
|
||||
SRCS= functions.sh.in gendepends.sh.in init-common-post.sh.in \
|
||||
rc-functions.sh.in runscript.sh.in
|
||||
INC= init-common-post.sh rc-mount.sh functions.sh rc-functions.sh
|
||||
@ -13,9 +13,8 @@ include ${MK}/scripts.mk
|
||||
|
||||
_installafter:
|
||||
${INSTALL} -d ${DESTDIR}/${INITDIR}
|
||||
@# Put functions.sh into the init.d dir so 3rd party apps don't have to
|
||||
@# be multilib aware
|
||||
ln -snf ${PREFIX}/${RC_LIB}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
|
||||
@# Put functions.sh into init for backwards compat
|
||||
ln -snf ${LIBEXECDIR}/sh/functions.sh ${DESTDIR}/${INITDIR} || exit $$?
|
||||
|
||||
check test::
|
||||
./runtests.sh
|
||||
|
@ -47,7 +47,7 @@ _sanitize_path()
|
||||
local IFS=":" p= path=
|
||||
for p in $PATH; do
|
||||
case "$p" in
|
||||
@PREFIX@/@LIB@/rc/bin|@PREFIX@/@LIB@/rc/sbin);;
|
||||
@LIBEXECDIR@/bin|@LIBEXECDIR@/sbin);;
|
||||
@PREFIX@/bin|@PREFIX@/sbin|/usr/bin|/usr/sbin);;
|
||||
@PKG_PREFIX@/bin|@PKG_PREFIX@/sbin);;
|
||||
@LOCAL_PREFIX@/bin|@LOCAL_PREFIX@/sbin);;
|
||||
@ -70,7 +70,7 @@ _PREFIX=@PREFIX@
|
||||
_PKG_PREFIX=@PKG_PREFIX@
|
||||
_LOCAL_PREFIX=@LOCAL_PREFIX@
|
||||
_LOCAL_PREFIX=${_LOCAL_PREFIX:-/usr/local}
|
||||
_PATH=@PREFIX@/@LIB@/rc/bin
|
||||
_PATH=@LIBEXECDIR@/bin
|
||||
case "$_PREFIX" in
|
||||
"$_PKG_PREFIX"|"$_LOCAL_PREFIX") ;;
|
||||
*) _PATH="$_PATH:$_PREFIX/bin:$_PREFIX/sbin";;
|
||||
@ -104,7 +104,7 @@ else
|
||||
# the last ecmd
|
||||
for _e in ebegin eend error errorn einfo einfon ewarn ewarnn ewend \
|
||||
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; }"
|
||||
done
|
||||
unset _e
|
||||
|
@ -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.
|
||||
|
||||
# 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
|
||||
# the old service state data
|
||||
: ${RC_SVCDIR:=/@LIB@/rc/init.d}
|
||||
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
|
||||
: ${RC_SVCDIR:=@LIBEXECDIR@/init.d}
|
||||
case "$(rc --sys)" in
|
||||
OPENVZ|VSERVER) rm -rf "$RC_SVCDIR"/*;;
|
||||
*) if mountinfo --quiet "$RC_SVCDIR"; then
|
||||
@ -16,8 +17,8 @@ case "$(rc --sys)" in
|
||||
esac
|
||||
retval=$?
|
||||
|
||||
if [ -e "$RC_LIBDIR"/cache/deptree ]; then
|
||||
cp -p "$RC_LIBDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
|
||||
if [ -e "$RC_LIBEXECDIR"/cache/deptree ]; then
|
||||
cp -p "$RC_LIBEXECDIR"/cache/* "$RC_SVCDIR" 2>/dev/null
|
||||
fi
|
||||
|
||||
echo sysinit >"$RC_SVCDIR"/softlevel
|
||||
|
@ -3,8 +3,9 @@
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
: ${CONSOLE:=/dev/console}
|
||||
: ${RC_LIBEXECDIR:=@LIBEXECDIR@}
|
||||
|
||||
if [ -e "$RC_LIBDIR"/console/unicode ]; then
|
||||
if [ -e "$RC_LIBEXECDIR"/console/unicode ]; then
|
||||
termencoding="%G"
|
||||
kmode="-u"
|
||||
else
|
||||
@ -16,10 +17,10 @@ fi
|
||||
if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/consolefont \
|
||||
-o -e /etc/runlevels/"$RC_BOOTLEVEL"/consolefont ]; then
|
||||
printf "\033%s" "$termencoding" >"$CONSOLE" 2>/dev/null
|
||||
if [ -r "$RC_LIBDIR"/console/font -a -x /bin/setfont ]; then
|
||||
font="$(cat "$RC_LIBDIR"/console/font)"
|
||||
if [ -r "$RC_LIBEXECDIR"/console/font -a -x /bin/setfont ]; then
|
||||
font="$(cat "$RC_LIBEXECDIR"/console/font)"
|
||||
[ -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
|
||||
|
||||
@ -27,8 +28,8 @@ fi
|
||||
if [ -e /etc/runlevels/"$RC_DEFAULTLEVEL"/keymaps \
|
||||
-o -e /etc/runlevels/"$RC_BOOTLEVEL"/keymaps ]; then
|
||||
kbd_mode $kmode -C "$CONSOLE" 2>/dev/null
|
||||
if [ -r "$RC_LIBDIR"/console/keymap ]; then
|
||||
loadkeys "$RC_LIBDIR"/console/keymap 2>/dev/null
|
||||
if [ -r "$RC_LIBEXECDIR"/console/keymap ]; then
|
||||
loadkeys "$RC_LIBEXECDIR"/console/keymap 2>/dev/null
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -21,7 +21,7 @@ mount_svcdir()
|
||||
fi
|
||||
}
|
||||
|
||||
. "$RC_LIBDIR"/sh/functions.sh
|
||||
. "$RC_LIBEXECDIR"/sh/functions.sh
|
||||
[ -r /etc/rc.conf ] && . /etc/rc.conf
|
||||
|
||||
# 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
|
||||
fi
|
||||
|
||||
. "$RC_LIBDIR"/sh/init-common-post.sh
|
||||
. "$RC_LIBEXECDIR"/sh/init-common-post.sh
|
||||
|
@ -38,7 +38,7 @@ mount_svcdir()
|
||||
fi
|
||||
}
|
||||
|
||||
. /etc/init.d/functions.sh
|
||||
. "$RC_LIBEXECDIR"/sh/functions.sh
|
||||
[ -r /etc/rc.conf ] && . /etc/rc.conf
|
||||
|
||||
# By default VServer already has /proc mounted, but OpenVZ does not!
|
||||
@ -68,4 +68,4 @@ if $mountproc; then
|
||||
eend $?
|
||||
fi
|
||||
|
||||
. "$RC_LIBDIR"/sh/init-common-post.sh
|
||||
. "$RC_LIBEXECDIR"/sh/init-common-post.sh
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
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()
|
||||
@ -17,9 +17,9 @@ _addon_warn()
|
||||
|
||||
import_addon()
|
||||
{
|
||||
if [ -e "$RC_LIBDIR/addons/$1.sh" ]; then
|
||||
if [ -e /@LIB@/rc/addons/"$1".sh ]; then
|
||||
_addon_warn
|
||||
. "$RC_LIBDIR/addons/$1.sh"
|
||||
. /@LIB@/rc/addons/"$1".sh
|
||||
elif [ -e /@LIB@/rcscripts/addons/"$1".sh ]; then
|
||||
_addon_warn
|
||||
. /@LIB@/rcscripts/addons/"$1".sh
|
||||
@ -86,6 +86,6 @@ get_bootparam()
|
||||
|
||||
# Add our sbin to $PATH
|
||||
case "$PATH" in
|
||||
"$RC_LIBDIR"/sbin|"$RC_LIBDIR"/sbin:*);;
|
||||
*) export PATH="$RC_LIBDIR/sbin:$PATH";;
|
||||
"$RC_LIBEXECDIR"/sbin|"$RC_LIBEXECDIR"/sbin:*);;
|
||||
*) export PATH="$RC_LIBEXECDIR/sbin:$PATH";;
|
||||
esac
|
||||
|
@ -5,7 +5,7 @@
|
||||
# All rights reserved. Released under the 2-clause BSD license.
|
||||
|
||||
. @SYSCONFDIR@/init.d/functions.sh
|
||||
. "$RC_LIBDIR"/sh/rc-functions.sh
|
||||
. @LIBEXECDIR@/sh/rc-functions.sh
|
||||
|
||||
# Support LiveCD foo
|
||||
if [ -r /sbin/livecd-functions.sh ]; then
|
||||
@ -84,7 +84,7 @@ start()
|
||||
service_inactive && _inactive=true
|
||||
mark_service_inactive
|
||||
fi
|
||||
start-stop-daemon --start \
|
||||
eval start-stop-daemon --start \
|
||||
--exec $command \
|
||||
${procname:+--name} $procname \
|
||||
${pidfile:+--pidfile} $pidfile \
|
||||
|
@ -18,6 +18,7 @@ include ${MK}/debug.mk
|
||||
SED_CMD= -e 's:@PREFIX@:${PREFIX}:g'
|
||||
SED_CMD+= -e 's:@LIB@:${LIBNAME}: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 \
|
||||
echo "-e 's:@PKG_PREFIX@:${PKG_PREFIX}:g'"; \
|
||||
else \
|
||||
|
@ -31,7 +31,7 @@
|
||||
|
||||
#include "librc.h"
|
||||
|
||||
#define GENDEP RC_LIBDIR "/sh/gendepends.sh"
|
||||
#define GENDEP RC_LIBEXECDIR "/sh/gendepends.sh"
|
||||
|
||||
#define RC_DEPCONFIG RC_SVCDIR "/depconfig"
|
||||
|
||||
@ -647,6 +647,7 @@ static const DEPPAIR deppairs[] = {
|
||||
|
||||
static const char *const depdirs[] =
|
||||
{
|
||||
RC_SVCDIR,
|
||||
RC_SVCDIR "/starting",
|
||||
RC_SVCDIR "/started",
|
||||
RC_SVCDIR "/stopping",
|
||||
@ -742,10 +743,10 @@ rc_deptree_update(void)
|
||||
bool retval = true;
|
||||
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 */
|
||||
if (!getenv("RC_LIBDIR"))
|
||||
setenv("RC_LIBDIR", RC_LIBDIR, 0);
|
||||
if (!getenv("RC_LIBEXECDIR"))
|
||||
setenv("RC_LIBEXECDIR", RC_LIBEXECDIR, 0);
|
||||
|
||||
/* Phase 1 - source all init scripts and print dependencies */
|
||||
if (!(fp = popen(GENDEP, "r")))
|
||||
|
@ -36,11 +36,12 @@ __BEGIN_DECLS
|
||||
|
||||
#define RC_SYSCONFDIR "@SYSCONFDIR@"
|
||||
#define RC_LIBDIR "@PREFIX@/@LIB@/rc"
|
||||
#define RC_SVCDIR RC_LIBDIR "/init.d"
|
||||
#define RC_PLUGINDIR RC_LIBDIR "/plugins"
|
||||
#define RC_LIBEXECDIR "@LIBEXECDIR@"
|
||||
#define RC_SVCDIR RC_LIBEXECDIR "/init.d"
|
||||
#define RC_RUNLEVELDIR RC_SYSCONFDIR "/runlevels"
|
||||
#define RC_INITDIR RC_SYSCONFDIR "/init.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
|
||||
* On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD
|
||||
|
@ -8,7 +8,7 @@ CLEANFILES= version.h
|
||||
|
||||
BINDIR= ${PREFIX}/bin
|
||||
SBINDIR= ${PREFIX}/sbin
|
||||
LINKDIR= ${PREFIX}/${LIBNAME}/${PROG}
|
||||
LINKDIR= ${LIBEXECDIR}
|
||||
|
||||
BINLINKS= rc-status
|
||||
SBINLINKS= rc-service rc-update runscript start-stop-daemon
|
||||
@ -37,21 +37,13 @@ LDADD+= -lutil -lrc -leinfo
|
||||
MK= ../../mk
|
||||
include ${MK}/debug.mk
|
||||
include ${MK}/prog.mk
|
||||
include ${MK}/git.mk
|
||||
include ${MK}/cc.mk
|
||||
|
||||
include ${MK}/${MKTERMCAP}.mk
|
||||
LDADD+= ${LIBDL} ${LIBKVM}
|
||||
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
|
||||
version.h:
|
||||
sed -n -e 's/^VERSION=[[:space:]]*\([^[:space:]]*\).*/#define VERSION "\1${GITVER}\"/p' ../../Makefile > version.h
|
||||
|
@ -50,14 +50,15 @@
|
||||
#include "einfo.h"
|
||||
#include "rc.h"
|
||||
#include "rc-misc.h"
|
||||
#include "version.h"
|
||||
|
||||
#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 RC_CONF RC_SYSCONFDIR "/rc.conf"
|
||||
#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;
|
||||
|
||||
@ -221,7 +222,8 @@ env_config(void)
|
||||
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_TMPDIR", RC_SVCDIR "/tmp", 1);
|
||||
setenv("RC_BOOTLEVEL", RC_LEVEL_BOOT, 1);
|
||||
|
@ -72,8 +72,8 @@ const char rc_copyright[] = "Copyright (c) 2007-2008 Roy Marples";
|
||||
|
||||
#include "version.h"
|
||||
|
||||
#define INITSH RC_LIBDIR "/sh/init.sh"
|
||||
#define INITEARLYSH RC_LIBDIR "/sh/init-early.sh"
|
||||
#define INITSH RC_LIBEXECDIR "/sh/init.sh"
|
||||
#define INITEARLYSH RC_LIBEXECDIR "/sh/init-early.sh"
|
||||
|
||||
#define SHUTDOWN "/sbin/shutdown"
|
||||
#define SULOGIN "/sbin/sulogin"
|
||||
|
@ -398,10 +398,10 @@ svc_exec(const char *arg1, const char *arg2)
|
||||
service, strerror(errno));
|
||||
_exit(EXIT_FAILURE);
|
||||
} else {
|
||||
execl(RC_LIBDIR "/sh/runscript.sh",
|
||||
RC_LIBDIR "/sh/runscript.sh",
|
||||
execl(RC_LIBEXECDIR "/sh/runscript.sh",
|
||||
RC_LIBEXECDIR "/sh/runscript.sh",
|
||||
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));
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
@ -586,10 +586,9 @@ svc_start_check(void)
|
||||
fcntl(exclusive_fd, F_SETFD,
|
||||
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);
|
||||
|
||||
if (state & RC_SERVICE_STARTED) {
|
||||
ewarn("WARNING: %s has already been started", applet);
|
||||
return;
|
||||
} else if (state & RC_SERVICE_INACTIVE && !in_background)
|
||||
if (state & RC_SERVICE_STARTED)
|
||||
ewarnx("WARNING: %s has already been started", applet);
|
||||
else if (state & RC_SERVICE_INACTIVE && !in_background)
|
||||
ewarnx("WARNING: %s has already started, but is inactive",
|
||||
applet);
|
||||
|
||||
@ -837,10 +836,8 @@ svc_stop_check(RC_SERVICE *state)
|
||||
fcntl(exclusive_fd, F_SETFD,
|
||||
fcntl(exclusive_fd, F_GETFD, 0) | FD_CLOEXEC);
|
||||
|
||||
if (*state & RC_SERVICE_STOPPED) {
|
||||
ewarn("WARNING: %s is already stopped", applet);
|
||||
return;
|
||||
}
|
||||
if (*state & RC_SERVICE_STOPPED)
|
||||
ewarnx("WARNING: %s is already stopped", applet);
|
||||
|
||||
rc_service_mark(service, RC_SERVICE_STOPPING);
|
||||
hook_out = RC_HOOK_SERVICE_STOP_OUT;
|
||||
|
@ -1188,8 +1188,8 @@ start_stop_daemon(int argc, char **argv)
|
||||
while (*p == ':')
|
||||
p++;
|
||||
}
|
||||
if (strcmp(token, RC_LIBDIR "/bin") != 0 &&
|
||||
strcmp(token, RC_LIBDIR "/sbin") != 0)
|
||||
if (strcmp(token, RC_LIBEXECDIR "/bin") != 0 &&
|
||||
strcmp(token, RC_LIBEXECDIR "/sbin") != 0)
|
||||
{
|
||||
len = strlen(token);
|
||||
if (np != newpath)
|
||||
|
Loading…
Reference in New Issue
Block a user