Support the use of PREFIX and PKG_PREFIX.
This commit is contained in:
parent
aabf3976db
commit
f092045650
7
README
7
README
@ -13,6 +13,8 @@ DESTDIR=/tmp/openrc-image
|
|||||||
MKPAM=pam
|
MKPAM=pam
|
||||||
MKTERMCAP=ncurses
|
MKTERMCAP=ncurses
|
||||||
MKTERMCAP=termcap
|
MKTERMCAP=termcap
|
||||||
|
PKG_PREFIX=/usr/pkg
|
||||||
|
PREFIX=/usr/local
|
||||||
|
|
||||||
We don't support building a static OpenRC with PAM.
|
We don't support building a static OpenRC with PAM.
|
||||||
You may need to use PROGLDFLAGS=-Wl,-Bstatic on glibc instead of just -static.
|
You may need to use PROGLDFLAGS=-Wl,-Bstatic on glibc instead of just -static.
|
||||||
@ -20,6 +22,9 @@ You may need to use PROGLDFLAGS=-Wl,-Bstatic on glibc instead of just -static.
|
|||||||
You can also brand OpenRC if you so wish like so
|
You can also brand OpenRC if you so wish like so
|
||||||
BRANDING=\"Gentoo/$(uname -s)\"
|
BRANDING=\"Gentoo/$(uname -s)\"
|
||||||
|
|
||||||
|
PKG_PREFIX should be set to where packages install to by default.
|
||||||
|
PREFIX should be set when OpenRC is not installed to /.
|
||||||
|
|
||||||
If any of the following files exist then we do not overwrite them
|
If any of the following files exist then we do not overwrite them
|
||||||
/etc/devd.conf
|
/etc/devd.conf
|
||||||
/etc/rc
|
/etc/rc
|
||||||
@ -40,7 +45,6 @@ tweaking on a per distro basis. They are also non essential to the operation
|
|||||||
of the system.
|
of the system.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reporting Bugs
|
Reporting Bugs
|
||||||
-------------
|
-------------
|
||||||
If you installed OpenRC from your chosen distribution, you should report
|
If you installed OpenRC from your chosen distribution, you should report
|
||||||
@ -50,7 +54,6 @@ then you should reports bugs to http://bugs.gentoo.org.
|
|||||||
Otherwise, you can report them directly to me at http://bugs.marples.name
|
Otherwise, you can report them directly to me at http://bugs.marples.name
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
History - by Roy Marples
|
History - by Roy Marples
|
||||||
------------------------
|
------------------------
|
||||||
I became a Gentoo/Linux developer in 2004 and wrote the modular network
|
I became a Gentoo/Linux developer in 2004 and wrote the modular network
|
||||||
|
8
mk/os.mk
8
mk/os.mk
@ -29,3 +29,11 @@ LIBDL?= ${_LIBDL}$(shell ${_LIBDL_SH})
|
|||||||
_LIBKVM_SH= case `uname -s` in *BSD) echo "-lkvm";; *) echo;; esac
|
_LIBKVM_SH= case `uname -s` in *BSD) echo "-lkvm";; *) echo;; esac
|
||||||
_LIBKVM!= ${_LIBKVM_SH}
|
_LIBKVM!= ${_LIBKVM_SH}
|
||||||
LIBKVM?= ${_LIBKVM}$(shell ${_LIBKVM_SH})
|
LIBKVM?= ${_LIBKVM}$(shell ${_LIBKVM_SH})
|
||||||
|
|
||||||
|
_PREFIX_SH= if test -n "${PREFIX}" && test "${PREFIX}" != "/"; then echo "-DPREFIX=\\\"${PREFIX}\\\""; else echo ""; fi
|
||||||
|
_PREFIX!= ${_PREFIX_SH}
|
||||||
|
CFLAGS+= ${_PREFIX}$(shell ${_PREFIX_SH})
|
||||||
|
|
||||||
|
_PKG_PREFIX_SH= if test -n "${PKG_PREFIX}" && test "${PKG_PREFIX}" != "/"; then echo "-DPKG_PREFIX=\\\"${PKG_PREFIX}\\\""; else echo ""; fi
|
||||||
|
_PKG_PREFIX!= ${_PKG_PREFIX_SH}
|
||||||
|
CFLAGS+= ${_PKG_PREFIX}$(shell ${_PKG_PREFIX_SH})
|
||||||
|
@ -16,24 +16,24 @@ include ${MK}/os.mk
|
|||||||
# Tweak our shell scripts
|
# Tweak our shell scripts
|
||||||
.SUFFIXES: .sh.in
|
.SUFFIXES: .sh.in
|
||||||
.sh.in.sh:
|
.sh.in.sh:
|
||||||
sed -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' $< > $@
|
sed -e 's:@SHELL@:${SH}:g' -e 's:@LIB@:${LIBNAME}:g' -e 's:@PREFIX@:${PREFIX}:g' -e 's:@PKG_PREFIX@:${PKG_PREFIX}:g' $< > $@
|
||||||
|
|
||||||
all: ${OBJS}
|
all: ${OBJS}
|
||||||
|
|
||||||
realinstall: ${BIN} ${CONF} ${CONF_APPEND}
|
realinstall: ${BIN} ${CONF} ${CONF_APPEND}
|
||||||
if test -n "${DIR}"; then ${INSTALL} -d ${DESTDIR}${DIR} || exit $$?; fi
|
if test -n "${DIR}"; then ${INSTALL} -d ${DESTDIR}/${PREFIX}${DIR} || exit $$?; fi
|
||||||
if test -n "${BIN}"; then ${INSTALL} -m ${BINMODE} ${BIN} ${DESTDIR}${DIR} || exit $$?; fi
|
if test -n "${BIN}"; then ${INSTALL} -m ${BINMODE} ${BIN} ${DESTDIR}/${PREFIX}${DIR} || exit $$?; fi
|
||||||
if test -n "${INC}"; then ${INSTALL} -m ${INCMODE} ${INC} ${DESTDIR}${DIR} || exit $$?; fi
|
if test -n "${INC}"; then ${INSTALL} -m ${INCMODE} ${INC} ${DESTDIR}/${PREFIX}${DIR} || exit $$?; fi
|
||||||
for x in ${CONF}; do \
|
for x in ${CONF}; do \
|
||||||
if ! test -e ${DESTDIR}${DIR}/$$x; then \
|
if ! test -e ${DESTDIR}/${PREFIX}${DIR}/$$x; then \
|
||||||
${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}${DIR} || exit $$?; \
|
${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${PREFIX}${DIR} || exit $$?; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
for x in ${CONF_APPEND}; do \
|
for x in ${CONF_APPEND}; do \
|
||||||
if test -e ${DESTDIR}${DIR}/$$x; then \
|
if test -e ${DESTDIR}/${PREFIX}${DIR}/$$x; then \
|
||||||
cat $$x >> ${DESTDIR}${DIR}/$$x || exit $$?; \
|
cat $$x >> ${DESTDIR}/${PREFIX}${DIR}/$$x || exit $$?; \
|
||||||
else \
|
else \
|
||||||
${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}${DIR} || exit $$?; \
|
${INSTALL} -m ${CONFMODE} $$x ${DESTDIR}/${PREFIX}${DIR} || exit $$?; \
|
||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
15
mk/sys.mk
15
mk/sys.mk
@ -7,23 +7,26 @@ INSTALL?= install
|
|||||||
RANLIB?= ranlib
|
RANLIB?= ranlib
|
||||||
SH= /bin/sh
|
SH= /bin/sh
|
||||||
|
|
||||||
|
PREFIX=
|
||||||
|
PKG_PREFIX= /usr/local
|
||||||
|
|
||||||
PICFLAG?= -fPIC
|
PICFLAG?= -fPIC
|
||||||
|
|
||||||
BINDIR?= /sbin
|
BINDIR?= ${PREFIX}/sbin
|
||||||
BINMODE?= 0755
|
BINMODE?= 0755
|
||||||
|
|
||||||
INCDIR?= /usr/include
|
INCDIR?= ${PREFIX}/usr/include
|
||||||
INCMODE?= 0444
|
INCMODE?= 0444
|
||||||
|
|
||||||
LIBNAME?= lib
|
LIBNAME?= lib
|
||||||
LIBDIR?= /usr/${LIBNAME}
|
LIBDIR?= ${PREFIX}/usr/${LIBNAME}
|
||||||
LIBMODE?= 0444
|
LIBMODE?= 0444
|
||||||
SHLIBDIR?= /${LIBNAME}
|
SHLIBDIR?= ${PREFIX}/${LIBNAME}
|
||||||
|
|
||||||
MANDIR?= /usr/share/man/man
|
MANDIR?= ${PREFIX}/usr/share/man/man
|
||||||
MANMODE?= 0444
|
MANMODE?= 0444
|
||||||
|
|
||||||
DOCDIR?= /usr/share/doc
|
DOCDIR?= ${PREFIX}/usr/share/doc
|
||||||
DOCMODE?= 0644
|
DOCMODE?= 0644
|
||||||
|
|
||||||
CONFMODE?= 0644
|
CONFMODE?= 0644
|
||||||
|
@ -13,7 +13,7 @@ include ${MK}/scripts.mk
|
|||||||
_installafter:
|
_installafter:
|
||||||
${INSTALL} -d ${DESTDIR}/etc/init.d
|
${INSTALL} -d ${DESTDIR}/etc/init.d
|
||||||
@# Provide an init script for the loopback interface
|
@# Provide an init script for the loopback interface
|
||||||
ln -snf ${RC_LIB}/sh/net.sh ${DESTDIR}/etc/init.d/${NET_LO} || exit $$?
|
ln -snf ${RC_LIB}/sh/net.sh ${DESTDIR}/${PREFIX}/etc/init.d/${NET_LO} || exit $$?
|
||||||
@# Put functions.sh into the init.d dir so 3rd party apps don't have to
|
@# Put functions.sh into the init.d dir so 3rd party apps don't have to
|
||||||
@# be multilib aware
|
@# be multilib aware
|
||||||
ln -snf ${RC_LIB}/sh/functions.sh ${DESTDIR}/etc/init.d || exit $$?
|
ln -snf ${RC_LIB}/sh/functions.sh ${DESTDIR}/${PREFIX}/etc/init.d || exit $$?
|
||||||
|
@ -43,7 +43,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
|
||||||
/lib/rc/sbin|/bin|/sbin|/usr/bin|/usr/sbin|/usr/pkg/bin|/usr/pkg/sbin|/usr/local/bin|/usr/local/sbin);;
|
@PREFIX@/lib/rc/sbin|/bin|/sbin|/usr/bin|/usr/sbin|@PKG_PREFIX@/bin|@PKG_PREFIX/sbin);;
|
||||||
*) path="${path}:${p}";;
|
*) path="${path}:${p}";;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
@ -60,7 +60,7 @@ if [ -n "${ZSH_VERSION}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Add our bin to $PATH
|
# Add our bin to $PATH
|
||||||
export PATH="/lib/rc/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin:/usr/local/bin:/usr/local/sbin$(_sanitize_path "${PATH}")"
|
export PATH="@PREFIX@/lib/rc/bin:/bin:/sbin:/usr/bin:/usr/sbin:@PKG_PREFIX@/bin:@PKG_PREFIX@/sbin:$(_sanitize_path "${PATH}")"
|
||||||
unset _sanitize_path
|
unset _sanitize_path
|
||||||
|
|
||||||
for arg; do
|
for arg; do
|
||||||
|
@ -75,6 +75,6 @@ get_bootparam()
|
|||||||
|
|
||||||
# Add our sbin to $PATH
|
# Add our sbin to $PATH
|
||||||
case "${PATH}" in
|
case "${PATH}" in
|
||||||
/lib/rc/sbin|/lib/rc/sbin:*);;
|
@PREFIX@/lib/rc/sbin|@PREFIX@/lib/rc/sbin:*);;
|
||||||
*) export PATH="/lib/rc/sbin:${PATH}";;
|
*) export PATH="@PREFIX@/lib/rc/sbin:${PATH}";;
|
||||||
esac
|
esac
|
||||||
|
@ -38,21 +38,30 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#ifndef LIB
|
#ifndef LIB
|
||||||
# define LIB "lib"
|
# define LIB "lib"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef PREFIX
|
||||||
|
# define PREFIX ""
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RC_LEVEL_BOOT "boot"
|
#define RC_LEVEL_BOOT "boot"
|
||||||
#define RC_LEVEL_DEFAULT "default"
|
#define RC_LEVEL_DEFAULT "default"
|
||||||
|
|
||||||
#define RC_LIBDIR "/" LIB "/rc"
|
#define RC_LIBDIR PREFIX "/" LIB "/rc"
|
||||||
#define RC_SVCDIR RC_LIBDIR "/init.d"
|
#define RC_SVCDIR RC_LIBDIR "/init.d"
|
||||||
#define RC_DEPTREE RC_SVCDIR "/deptree"
|
#define RC_DEPTREE RC_SVCDIR "/deptree"
|
||||||
#define RC_RUNLEVELDIR "/etc/runlevels"
|
#define RC_RUNLEVELDIR PREFIX "/etc/runlevels"
|
||||||
#define RC_INITDIR "/etc/init.d"
|
#define RC_INITDIR PREFIX "/etc/init.d"
|
||||||
#define RC_CONFDIR "/etc/conf.d"
|
#define RC_CONFDIR PREFIX "/etc/conf.d"
|
||||||
|
|
||||||
#define RC_INITDIR_LOCAL "/usr/local/etc/init.d"
|
/* PKG_PREFIX is where packages are installed if different from the base OS
|
||||||
#define RC_CONFDIR_LOCAL "/usr/local/etc/conf.d"
|
* On Gentoo this is normally unset, on FreeBSD /usr/local and on NetBSD
|
||||||
|
* /usr/pkg. */
|
||||||
|
#ifdef PKG_PREFIX
|
||||||
|
# define RC_PKG_INITDIR PKG_PREFIX "/etc/init.d"
|
||||||
|
# define RC_PKG_CONFDIR PKG_PREFIX "/usr/local/etc/conf.d"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define RC_KSOFTLEVEL RC_SVCDIR "/ksoftlevel"
|
#define RC_KSOFTLEVEL RC_SVCDIR "/ksoftlevel"
|
||||||
#define RC_STARTING RC_SVCDIR "/rc.starting"
|
#define RC_STARTING RC_SVCDIR "/rc.starting"
|
||||||
|
@ -7,8 +7,6 @@ SRCS= libeinfo.c
|
|||||||
INCS= einfo.h
|
INCS= einfo.h
|
||||||
VERSION_MAP= einfo.map
|
VERSION_MAP= einfo.map
|
||||||
|
|
||||||
SHLIBDIR= /${LIBNAME}
|
|
||||||
|
|
||||||
CFLAGS+= -I../includes
|
CFLAGS+= -I../includes
|
||||||
|
|
||||||
include ${MK}/cc.mk
|
include ${MK}/cc.mk
|
||||||
|
@ -13,7 +13,5 @@ LDADD+= ${LIBKVM}
|
|||||||
|
|
||||||
CFLAGS+= -I../includes
|
CFLAGS+= -I../includes
|
||||||
|
|
||||||
SHLIBDIR= /${LIBNAME}
|
|
||||||
|
|
||||||
include ${MK}/cc.mk
|
include ${MK}/cc.mk
|
||||||
include ${MK}/lib.mk
|
include ${MK}/lib.mk
|
||||||
|
@ -696,8 +696,12 @@ bool rc_deptree_update_needed (void)
|
|||||||
if (! existss (RC_DEPTREE) ||
|
if (! existss (RC_DEPTREE) ||
|
||||||
! rc_newer_than (RC_DEPTREE, RC_INITDIR) ||
|
! rc_newer_than (RC_DEPTREE, RC_INITDIR) ||
|
||||||
! rc_newer_than (RC_DEPTREE, RC_CONFDIR) ||
|
! rc_newer_than (RC_DEPTREE, RC_CONFDIR) ||
|
||||||
! rc_newer_than (RC_DEPTREE, RC_INITDIR_LOCAL) ||
|
#ifdef RC_PKG_INITDIR
|
||||||
! rc_newer_than (RC_DEPTREE, RC_CONFDIR_LOCAL) ||
|
! rc_newer_than (RC_DEPTREE, RC_PKG_INITDIR) ||
|
||||||
|
#endif
|
||||||
|
#ifdef RC_PKG_CONFDIR
|
||||||
|
! rc_newer_than (RC_DEPTREE, RC_PKG_CONFDIR) ||
|
||||||
|
#endif
|
||||||
! rc_newer_than (RC_DEPTREE, "/etc/rc.conf"))
|
! rc_newer_than (RC_DEPTREE, "/etc/rc.conf"))
|
||||||
return (true);
|
return (true);
|
||||||
|
|
||||||
|
@ -328,11 +328,13 @@ char *rc_service_resolve (const char *service)
|
|||||||
snprintf (buffer, sizeof (buffer), RC_INITDIR "/%s", service);
|
snprintf (buffer, sizeof (buffer), RC_INITDIR "/%s", service);
|
||||||
|
|
||||||
/* So we don't exist in /etc/init.d - check /usr/local/etc/init.d */
|
/* So we don't exist in /etc/init.d - check /usr/local/etc/init.d */
|
||||||
|
#ifdef RC_PKG_INITDIR
|
||||||
if (stat (buffer, &buf) != 0) {
|
if (stat (buffer, &buf) != 0) {
|
||||||
snprintf (buffer, sizeof (buffer), RC_INITDIR_LOCAL "/%s", service);
|
snprintf (buffer, sizeof (buffer), RC_PKG_INITDIR "/%s", service);
|
||||||
if (stat (buffer, &buf) != 0)
|
if (stat (buffer, &buf) != 0)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return (xstrdup (buffer));
|
return (xstrdup (buffer));
|
||||||
}
|
}
|
||||||
@ -781,12 +783,18 @@ char **rc_services_in_runlevel (const char *runlevel)
|
|||||||
|
|
||||||
if (! runlevel) {
|
if (! runlevel) {
|
||||||
int i;
|
int i;
|
||||||
char **local = ls_dir (RC_INITDIR_LOCAL, LS_INITD);
|
#ifdef RC_PKG_INITDIR
|
||||||
|
char **local = ls_dir (RC_PKG_INITDIR, LS_INITD);
|
||||||
|
#endif
|
||||||
|
|
||||||
list = ls_dir (RC_INITDIR, LS_INITD);
|
list = ls_dir (RC_INITDIR, LS_INITD);
|
||||||
|
|
||||||
|
#ifdef RC_PKG_INITDIR
|
||||||
STRLIST_FOREACH (local, dir, i)
|
STRLIST_FOREACH (local, dir, i)
|
||||||
rc_strlist_addsortu (&list, dir);
|
rc_strlist_addsortu (&list, dir);
|
||||||
rc_strlist_free (local);
|
rc_strlist_free (local);
|
||||||
|
#endif
|
||||||
|
|
||||||
return (list);
|
return (list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,10 @@ SRCS= checkpath.c fstabinfo.c mountinfo.c \
|
|||||||
|
|
||||||
CLEANFILES= version.h
|
CLEANFILES= version.h
|
||||||
|
|
||||||
BINDIR?= /sbin
|
BINDIR= ${PREFIX}/bin
|
||||||
|
SBINDIR= ${PREFIX}/sbin
|
||||||
|
LINKDIR= ${PREFIX}/${LIBNAME}/${PROG}
|
||||||
|
|
||||||
LINKDIR= ${LIBNAME}/${PROG}
|
|
||||||
BINLINKS= rc-status
|
BINLINKS= rc-status
|
||||||
SBINLINKS= rc-update runscript start-stop-daemon
|
SBINLINKS= rc-update runscript start-stop-daemon
|
||||||
RC_BINLINKS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
|
RC_BINLINKS= einfon einfo ewarnn ewarn eerrorn eerror ebegin eend ewend \
|
||||||
@ -50,16 +51,16 @@ version.h:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
|
${INSTALL} -d ${DESTDIR}${SBINDIR}
|
||||||
|
${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${SBINDIR}
|
||||||
${INSTALL} -d ${DESTDIR}${BINDIR}
|
${INSTALL} -d ${DESTDIR}${BINDIR}
|
||||||
${INSTALL} -m ${BINMODE} ${PROG} ${DESTDIR}${BINDIR}
|
for x in ${BINLINKS}; do ln -fs ${DESTDIR}${SBINDIR}/${PROG} ${DESTDIR}${BINDIR}/$$x; done
|
||||||
${INSTALL} -d ${DESTDIR}/bin
|
${INSTALL} -d ${DESTDIR}${SBINDIR}
|
||||||
for x in ${BINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}/bin/$$x; done
|
for x in ${SBINLINKS}; do ln -fs ${PROG} ${DESTDIR}${SBINDIR}/$$x; done
|
||||||
${INSTALL} -d ${DESTDIR}/bin
|
${INSTALL} -d ${DESTDIR}${LINKDIR}/bin
|
||||||
for x in ${SBINLINKS}; do ln -fs ${PROG} ${DESTDIR}${BINDIR}/$$x; done
|
for x in $(RC_BINLINKS); do ln -fs ${DESTDIR}${SBINDIR}/${PROG} ${DESTDIR}${LINKDIR}/bin/$$x; done
|
||||||
${INSTALL} -d ${DESTDIR}/${LIBNAME}/${PROG}/bin
|
${INSTALL} -d ${DESTDIR}${LINKDIR}/sbin
|
||||||
for x in $(RC_BINLINKS); do ln -fs ${BINDIR}/${PROG} $(DESTDIR)/${LIBNAME}/${PROG}/bin/$$x; done
|
for x in ${RC_SBINLINKS}; do ln -fs ${DESTDIR}${SBINDIR}/${PROG} ${DESTDIR}${LINKDIR}/sbin/$$x; done
|
||||||
${INSTALL} -d ${DESTDIR}/${LIBNAME}/${PROG}/sbin
|
|
||||||
for x in ${RC_SBINLINKS}; do ln -fs ${BINDIR}/${PROG} ${DESTDIR}/${LIBNAME}/${PROG}/sbin/$$x; done
|
|
||||||
if test "${MKPAM}" = pam; then \
|
if test "${MKPAM}" = pam; then \
|
||||||
${INSTALL} -d ${DESTDIR}${PAMDIR}; \
|
${INSTALL} -d ${DESTDIR}${PAMDIR}; \
|
||||||
${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
|
${INSTALL} -m ${PAMMODE} start-stop-daemon.pam ${DESTDIR}${PAMDIR}/start-stop-daemon; \
|
||||||
|
Loading…
Reference in New Issue
Block a user