From 6d1b4a47305811eb613e6c70b39f59620bf1e7b1 Mon Sep 17 00:00:00 2001 From: Gordon Tetlow Date: Sun, 29 Jun 2003 18:46:18 +0000 Subject: [PATCH] Tweak a couple of utilities so they compile cleanly for /rescue. Mostly path fixes. Submitted by: Tim Kientzle --- bin/csh/Makefile | 4 ++++ contrib/isc-dhcp/includes/cf/freebsd.h | 12 ++++++++++++ sbin/dhclient/Makefile | 3 ++- sbin/dhclient/client/Makefile | 7 ++++++- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/bin/csh/Makefile b/bin/csh/Makefile index 228125df409b..64def186505f 100644 --- a/bin/csh/Makefile +++ b/bin/csh/Makefile @@ -10,7 +10,11 @@ TCSHDIR= ${.CURDIR}/../../contrib/tcsh .PATH: ${TCSHDIR} PROG= csh +.if defined(RESCUE) +DFLAGS= -D_PATH_TCSHELL='"/rescue/${PROG}"' +.else DFLAGS= -D_PATH_TCSHELL='"/bin/${PROG}"' +.endif CFLAGS+= -I. -I${.CURDIR} -I${TCSHDIR} ${DFLAGS} WARNS= 2 SRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \ diff --git a/contrib/isc-dhcp/includes/cf/freebsd.h b/contrib/isc-dhcp/includes/cf/freebsd.h index eefbce3c5f8d..db15c30226e6 100644 --- a/contrib/isc-dhcp/includes/cf/freebsd.h +++ b/contrib/isc-dhcp/includes/cf/freebsd.h @@ -103,6 +103,10 @@ extern int h_errno; #define SOCKLEN_T int #endif +#ifdef RESCUE +#define _PATH_DHCLIENT_SCRIPT "/rescue/dhclient-script" +#endif + #if defined (USE_DEFAULT_NETWORK) # define USE_BPF #endif @@ -113,6 +117,9 @@ extern int h_errno; #endif /* HAVE_DEV_RANDOM */ const char *cmds[] = { +#ifndef RESCUE + /* rescue environment can't rely on these ... */ + /* Actually, /sbin/dhclient shouldn't use these, either. */ "/bin/ps -axlw 2>&1", "/usr/sbin/arp -an 2>&1", "/usr/bin/netstat -an 2>&1", @@ -123,10 +130,12 @@ const char *cmds[] = { "/usr/sbin/iostat 2>&1", "/usr/bin/vmstat 2>&1", "/usr/bin/w 2>&1", +#endif NULL }; const char *dirs[] = { +#ifndef RESCUE "/tmp", "/usr/tmp", ".", @@ -136,13 +145,16 @@ const char *dirs[] = { "/var/mail", "/home", "/usr/home", +#endif NULL }; const char *files[] = { +#ifndef RESCUE "/var/log/messages", "/var/log/wtmp", "/var/log/lastlog", +#endif NULL }; #endif /* NEED_PRAND_CONF */ diff --git a/sbin/dhclient/Makefile b/sbin/dhclient/Makefile index 9f2384f6d0f2..372adfdfd47a 100644 --- a/sbin/dhclient/Makefile +++ b/sbin/dhclient/Makefile @@ -52,8 +52,9 @@ OBJS+= dhcpctl/dhcpctl.o dhcpctl/callback.o dhcpctl/remote.o # though, so we must run ``make all'' instead when we are asked to # generate an individual object file. +# Note: Must have some commands here to override the default build action ${OBJS}: all - + @true .endif .include diff --git a/sbin/dhclient/client/Makefile b/sbin/dhclient/client/Makefile index f4a609d5e6a6..c82c9122b34e 100644 --- a/sbin/dhclient/client/Makefile +++ b/sbin/dhclient/client/Makefile @@ -8,7 +8,12 @@ DIST_DIR= ${.CURDIR}/../../../contrib/isc-dhcp PROG= dhclient SRCS= clparse.c dhclient.c -CFLAGS+= -DCLIENT_PATH='"PATH=/sbin:/bin:/usr/sbin:/usr/bin"' -Dwarn=dhcp_warn +.if defined(RESCUE) +CFLAGS+= -DCLIENT_PATH='"PATH=/rescue:/sbin:/bin:/usr/sbin:/usr/bin"' +.else +CFLAGS+= -DCLIENT_PATH='"PATH=/sbin:/bin:/usr/sbin:/usr/bin"' +.endif +CFLAGS+= -Dwarn=dhcp_warn DPADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST} LDADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST}