From owner-freebsd-arch@FreeBSD.ORG Thu May 8 08:42:28 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id F0BA737B401 for ; Thu, 8 May 2003 08:42:27 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0A73943FA3 for ; Thu, 8 May 2003 08:42:26 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h48FgPTl019934 for ; Thu, 8 May 2003 09:42:25 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Thu, 08 May 2003 09:42:06 -0600 (MDT) Message-Id: <20030508.094206.68986125.imp@bsdimp.com> To: arch@freebsd.org From: "M. Warner Losh" X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Thu_May__8_09:42:06_2003_428)--" Content-Transfer-Encoding: 7bit Subject: Fw: /rescue X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 May 2003 15:42:28 -0000 ----Next_Part(Thu_May__8_09:42:06_2003_428)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Dang. I posted the wrong version of the patch. Here's the latest one he sent me/hackers@ Warner ----Next_Part(Thu_May__8_09:42:06_2003_428)-- Content-Type: Message/Rfc822 Content-Transfer-Encoding: 7bit Content-Disposition: inline Return-Path: owner-freebsd-hackers@FreeBSD.ORG Delivery-Date: Thu, 23 Jan 2003 23:41:44 -0700 Received: from rover.village.org (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.6/8.12.3) with ESMTP id h0O6fZ1e007221 for ; Thu, 23 Jan 2003 23:41:35 -0700 (MST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from mx2.freebsd.org (mx2.freebsd.org [216.136.204.119]) by rover.village.org (8.12.5/8.12.3) with ESMTP id h0O6fW7G029921 for ; Thu, 23 Jan 2003 23:41:32 -0700 (MST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from hub.freebsd.org (hub.freebsd.org [216.136.204.18]) by mx2.freebsd.org (Postfix) with ESMTP id 841FD5576F; Thu, 23 Jan 2003 22:41:23 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: by hub.freebsd.org (Postfix, from userid 538) id 5639837B405; Thu, 23 Jan 2003 22:41:22 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by hub.freebsd.org (Postfix) with SMTP id 378182E8009; Thu, 23 Jan 2003 22:41:22 -0800 (PST) Received: by hub.freebsd.org (bulk_mailer v1.12); Thu, 23 Jan 2003 22:41:22 -0800 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 547BC37B401 for ; Thu, 23 Jan 2003 22:40:56 -0800 (PST) Received: from kientzle.com (h-66-166-149-50.SNVACAID.covad.net [66.166.149.50]) by mx1.FreeBSD.org (Postfix) with ESMTP id E71C943ED8 for ; Thu, 23 Jan 2003 22:40:54 -0800 (PST) (envelope-from kientzle@acm.org) Received: from acm.org ([66.166.149.51]) by kientzle.com (8.11.3/8.11.3) with ESMTP id h0O6eeR04331; Thu, 23 Jan 2003 22:40:40 -0800 (PST) (envelope-from kientzle@acm.org) Message-ID: <3E30DFE7.50401@acm.org> Date: Thu, 23 Jan 2003 22:40:39 -0800 From: Tim Kientzle Reply-To: kientzle@acm.org User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.6) Gecko/20011206 X-Accept-Language: en-us, en MIME-Version: 1.0 To: "M. Warner Losh" Cc: freebsd-hackers@FreeBSD.ORG, Nate Lawson Subject: Re: /rescue References: <3E248D85.10201@acm.org> <20030114.231723.49603038.imp@bsdimp.com> Content-Type: multipart/mixed; boundary="------------030407000308050805040706" Sender: owner-freebsd-hackers@FreeBSD.ORG List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Precedence: bulk X-Spam-Status: No, hits=-11.8 required=5.0 tests=BALANCE_FOR_LONG_20K,EMAIL_ATTRIBUTION,PATCH_CONTEXT_DIFF, QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01, TO_BE_REMOVED_REPLY,USER_AGENT,USER_AGENT_MOZILLA_UA, X_ACCEPT_LANG,X_LOOP version=2.41 X-Spam-Level: This is a multi-part message in MIME format. --------------030407000308050805040706 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit M. Warner Losh wrote: > I'm curious why you did things this way, rather then with .PATH in the > makefile? > > *** /dev/null Wed Jan 8 20:22:00 2003 > --- rescue/librescue/exec.c Mon Dec 9 21:56:20 2002 > *************** > *** 0 **** > --- 1 ---- > + #include "../../lib/libc/gen/exec.c" Yep, .PATH does simplify things. Revised diff attached. Thanks for the suggestion. Tim --------------030407000308050805040706 Content-Type: text/plain; name="kientzle_rescue_2.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="kientzle_rescue_2.diff" Index: Makefile.inc1 =================================================================== RCS file: /mnt/cvs/src/Makefile.inc1,v retrieving revision 1.314 diff -c -r1.314 Makefile.inc1 *** Makefile.inc1 30 Dec 2002 10:01:25 -0000 1.314 --- Makefile.inc1 7 Jan 2003 05:52:24 -0000 *************** *** 51,56 **** --- 51,60 ---- SUBDIR+= lib .endif + .if exists(${.CURDIR}/rescue) + SUBDIR+= rescue + .endif + .if exists(${.CURDIR}/bin) SUBDIR+= bin .endif Index: bin/csh/Makefile =================================================================== RCS file: /mnt/cvs/src/bin/csh/Makefile,v retrieving revision 1.29 diff -c -r1.29 Makefile *** bin/csh/Makefile 24 Jul 2002 22:26:44 -0000 1.29 --- bin/csh/Makefile 7 Jan 2003 02:07:46 -0000 *************** *** 10,16 **** --- 10,20 ---- .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} SRCS= sh.c sh.dir.c sh.dol.c sh.err.c sh.exec.c sh.char.c \ sh.exp.c sh.file.c sh.func.c sh.glob.c sh.hist.c sh.init.c \ Index: bin/mv/mv.c =================================================================== RCS file: /mnt/cvs/src/bin/mv/mv.c,v retrieving revision 1.39 diff -c -r1.39 mv.c *** bin/mv/mv.c 9 Jul 2002 17:45:13 -0000 1.39 --- bin/mv/mv.c 7 Jan 2003 18:13:50 -0000 *************** *** 67,74 **** #include #include - #include "pathnames.h" - int fflg, iflg, nflg, vflg; int copy(char *, char *); --- 67,72 ---- Index: bin/mv/pathnames.h =================================================================== RCS file: /mnt/cvs/src/bin/mv/pathnames.h,v retrieving revision 1.6 diff -c -r1.6 pathnames.h *** bin/mv/pathnames.h 17 May 2002 11:38:48 -0000 1.6 --- bin/mv/pathnames.h 9 Jan 2003 02:34:27 -0000 *************** *** 34,37 **** * $FreeBSD: src/bin/mv/pathnames.h,v 1.6 2002/05/17 11:38:48 jmallett Exp $ */ ! #define _PATH_RM "/bin/rm" --- 34,37 ---- * $FreeBSD: src/bin/mv/pathnames.h,v 1.6 2002/05/17 11:38:48 jmallett Exp $ */ ! /* This file is empty and can be safely deleted */ Index: bin/sh/var.c =================================================================== RCS file: /mnt/cvs/src/bin/sh/var.c,v retrieving revision 1.23 diff -c -r1.23 var.c *** bin/sh/var.c 1 Oct 2002 00:54:14 -0000 1.23 --- bin/sh/var.c 1 Jan 2003 23:35:53 -0000 *************** *** 44,49 **** --- 44,50 ---- #include #include + #include /* * Shell variables. *************** *** 105,111 **** NULL }, { &vmpath, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH=", NULL }, ! { &vpath, VSTRFIXED|VTEXTFIXED, "PATH=/bin:/usr/bin", changepath }, { &vppid, VSTRFIXED|VTEXTFIXED|VUNSET, "PPID=", NULL }, --- 106,112 ---- NULL }, { &vmpath, VSTRFIXED|VTEXTFIXED|VUNSET, "MAILPATH=", NULL }, ! { &vpath, VSTRFIXED|VTEXTFIXED, "PATH=" _PATH_DEFPATH, changepath }, { &vppid, VSTRFIXED|VTEXTFIXED|VUNSET, "PPID=", NULL }, Index: contrib/isc-dhcp/client/clparse.c =================================================================== RCS file: /mnt/cvs/src/contrib/isc-dhcp/client/clparse.c,v retrieving revision 1.9 diff -c -r1.9 clparse.c *** contrib/isc-dhcp/client/clparse.c 16 Jan 2003 07:22:32 -0000 1.9 --- contrib/isc-dhcp/client/clparse.c 24 Jan 2003 06:01:43 -0000 *************** *** 53,59 **** struct client_config top_level_config; ! char client_script_name [] = "/sbin/dhclient-script"; u_int32_t default_requested_options [] = { DHO_SUBNET_MASK, --- 53,59 ---- struct client_config top_level_config; ! char client_script_name [] = _PATH_DHCLIENT_SCRIPT; u_int32_t default_requested_options [] = { DHO_SUBNET_MASK, Index: contrib/isc-dhcp/includes/cf/freebsd.h =================================================================== RCS file: /mnt/cvs/src/contrib/isc-dhcp/includes/cf/freebsd.h,v retrieving revision 1.5 diff -c -r1.5 freebsd.h *** contrib/isc-dhcp/includes/cf/freebsd.h 30 Sep 2002 08:45:34 -0000 1.5 --- contrib/isc-dhcp/includes/cf/freebsd.h 9 Jan 2003 02:35:47 -0000 *************** *** 103,108 **** --- 103,112 ---- #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,118 **** --- 117,125 ---- #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,132 **** --- 130,141 ---- "/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,148 **** --- 145,160 ---- "/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 */ Index: contrib/tar/src/buffer.c =================================================================== RCS file: /mnt/cvs/src/contrib/tar/src/buffer.c,v retrieving revision 1.5 diff -c -r1.5 buffer.c *** contrib/tar/src/buffer.c 9 Oct 2002 07:33:29 -0000 1.5 --- contrib/tar/src/buffer.c 22 Nov 2002 21:37:10 -0000 *************** *** 25,30 **** --- 25,36 ---- #include + #if __FreeBSD__ + # include + #else + # define _PATH_BSHELL "/bin/sh" + #endif + #if MSDOS # include #endif *************** *** 1549,1555 **** pid_t child; const char *shell = getenv ("SHELL"); if (! shell) ! shell = "/bin/sh"; child = xfork (); if (child == 0) { --- 1555,1561 ---- pid_t child; const char *shell = getenv ("SHELL"); if (! shell) ! shell = _PATH_BSHELL; child = xfork (); if (child == 0) { Index: etc/mtree/BSD.root.dist =================================================================== RCS file: /mnt/cvs/src/etc/mtree/BSD.root.dist,v retrieving revision 1.58 diff -c -r1.58 BSD.root.dist *** etc/mtree/BSD.root.dist 10 Jun 2002 04:47:26 -0000 1.58 --- etc/mtree/BSD.root.dist 7 Jan 2003 05:57:14 -0000 *************** *** 67,72 **** --- 67,74 ---- .. proc mode=0555 .. + rescue + .. root .. sbin Index: include/paths.h =================================================================== RCS file: /mnt/cvs/src/include/paths.h,v retrieving revision 1.17 diff -c -r1.17 paths.h *** include/paths.h 14 Jul 2002 13:04:15 -0000 1.17 --- include/paths.h 7 Jan 2003 06:34:34 -0000 *************** *** 40,57 **** --- 40,84 ---- #include /* Default search path. */ + #ifdef RESCUE + #define _PATH_DEFPATH "/rescue:/usr/bin:/bin" + #else #define _PATH_DEFPATH "/usr/bin:/bin" + #endif + /* All standard utilities path. */ + #ifdef RESCUE + #define _PATH_STDPATH \ + "/rescue:/usr/bin:/bin:/usr/sbin:/sbin" + #else #define _PATH_STDPATH \ "/usr/bin:/bin:/usr/sbin:/sbin:" + #endif #define _PATH_AUTHCONF "/etc/auth.conf" + + #ifdef RESCUE + #define _PATH_BSHELL "/rescue/sh" + #else #define _PATH_BSHELL "/bin/sh" + #endif + #define _PATH_CAPABILITY "/etc/capability" #define _PATH_CAPABILITY_DB "/etc/capability.db" #define _PATH_CONSOLE "/dev/console" + + #ifdef RESCUE + #define _PATH_CP "/rescue/cp" + #else #define _PATH_CP "/bin/cp" + #endif + + #ifdef RESCUE + #define _PATH_CSHELL "/rescue/csh" + #else #define _PATH_CSHELL "/bin/csh" + #endif + #define _PATH_DEFTAPE "/dev/sa0" #define _PATH_DEVDB "/var/run/dev.db" #define _PATH_DEVNULL "/dev/null" *************** *** 59,79 **** --- 86,136 ---- #define _PATH_DRUM "/dev/drum" #define _PATH_ETC "/etc" #define _PATH_FTPUSERS "/etc/ftpusers" + + #ifdef RESCUE + #define _PATH_IFCONFIG "/rescue/ifconfig" + #else + #define _PATH_IFCONFIG "/sbin/ifconfig" + #endif + #define _PATH_KMEM "/dev/kmem" #define _PATH_LOGIN "/usr/bin/login" #define _PATH_MAILDIR "/var/mail" #define _PATH_MAN "/usr/share/man" #define _PATH_MEM "/dev/mem" #define _PATH_NOLOGIN "/var/run/nologin" + + #ifdef RESCUE + #define _PATH_RCP "/rescue/rcp" + #else #define _PATH_RCP "/bin/rcp" + #endif + #define _PATH_RLOGIN "/usr/bin/rlogin" + + #ifdef RESCUE + #define _PATH_RM "/rescue/rm" + #else + #define _PATH_RM "/bin/rm" + #endif + #define _PATH_RSH "/usr/bin/rsh" #define _PATH_SENDMAIL "/usr/sbin/sendmail" #define _PATH_SHELLS "/etc/shells" #define _PATH_TTY "/dev/tty" #define _PATH_UNIX "don't use _PATH_UNIX" + + #ifdef RESCUE + #define _PATH_VI "/rescue/vi" + #else #define _PATH_VI "/usr/bin/vi" + #endif + + #ifdef RESCUE + #define _PATH_WALL "/rescue/wall" + #else #define _PATH_WALL "/usr/bin/wall" + #endif /* Provide trailing slash, since mostly used for building pathnames. */ #define _PATH_DEV "/dev/" Index: sbin/dhclient/Makefile =================================================================== RCS file: /mnt/cvs/src/sbin/dhclient/Makefile,v retrieving revision 1.17 diff -c -r1.17 Makefile *** sbin/dhclient/Makefile 28 Feb 2002 16:17:18 -0000 1.17 --- sbin/dhclient/Makefile 9 Jan 2003 02:38:00 -0000 *************** *** 47,54 **** # though, so we must run ``make all'' instead when we are asked to # generate an individual object file. ${OBJS}: all ! .endif .include --- 47,55 ---- # 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 Index: sbin/dhclient/client/Makefile =================================================================== RCS file: /mnt/cvs/src/sbin/dhclient/client/Makefile,v retrieving revision 1.2 diff -c -r1.2 Makefile *** sbin/dhclient/client/Makefile 19 Feb 2002 22:23:49 -0000 1.2 --- sbin/dhclient/client/Makefile 7 Jan 2003 05:43:08 -0000 *************** *** 8,14 **** PROG= dhclient SRCS= clparse.c dhclient.c ! CFLAGS+= -DCLIENT_PATH='"PATH=/sbin:/bin:/usr/sbin:/usr/bin"' -Dwarn=dhcp_warn DPADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST} LDADD= ${LIBDHCP} ${LIBRES} ${LIBOMAPI} ${LIBDST} --- 8,19 ---- PROG= dhclient SRCS= clparse.c dhclient.c ! .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} Index: sbin/fsck/fsck.c =================================================================== RCS file: /mnt/cvs/src/sbin/fsck/fsck.c,v retrieving revision 1.12 diff -c -r1.12 fsck.c *** sbin/fsck/fsck.c 31 Oct 2002 15:32:39 -0000 1.12 --- sbin/fsck/fsck.c 7 Jan 2003 05:43:26 -0000 *************** *** 283,288 **** --- 283,291 ---- { /* List of directories containing fsck_xxx subcommands. */ static const char *edirs[] = { + #ifdef RESCUE + _PATH_RESCUE, /* /rescue/fsck tries /rescue first */ + #endif _PATH_SBIN, _PATH_USRSBIN, NULL Index: sbin/fsck/pathnames.h =================================================================== RCS file: /mnt/cvs/src/sbin/fsck/pathnames.h,v retrieving revision 1.1 diff -c -r1.1 pathnames.h *** sbin/fsck/pathnames.h 9 Oct 2000 10:23:08 -0000 1.1 --- sbin/fsck/pathnames.h 10 Dec 2002 05:43:11 -0000 *************** *** 31,35 **** --- 31,36 ---- * $FreeBSD: src/sbin/fsck/pathnames.h,v 1.1 2000/10/09 10:23:08 adrian Exp $ */ + #define _PATH_RESCUE "/rescue" #define _PATH_SBIN "/sbin" #define _PATH_USRSBIN "/usr/sbin" Index: sbin/mdmfs/pathnames.h =================================================================== RCS file: /mnt/cvs/src/sbin/mdmfs/pathnames.h,v retrieving revision 1.2 diff -c -r1.2 pathnames.h *** sbin/mdmfs/pathnames.h 22 Sep 2002 09:46:28 -0000 1.2 --- sbin/mdmfs/pathnames.h 9 Jan 2003 04:20:16 -0000 *************** *** 2,9 **** --- 2,16 ---- #ifndef MDMFS_PATHNAMES_H #define MDMFS_PATHNAMES_H + /* Shouldn't all of these be moved into /usr/include/paths.h?? */ + #ifndef RESCUE #define PATH_MDCONFIG "/sbin/mdconfig" #define PATH_NEWFS "/sbin/newfs" #define PATH_MOUNT "/sbin/mount" + #else + #define PATH_MDCONFIG "/rescue/mdconfig" + #define PATH_NEWFS "/rescue/newfs" + #define PATH_MOUNT "/rescue/mount" + #endif #endif /* !MDMFS_PATHNAMES_H */ Index: sbin/mount/mount.c =================================================================== RCS file: /mnt/cvs/src/sbin/mount/mount.c,v retrieving revision 1.50 diff -c -r1.50 mount.c *** sbin/mount/mount.c 14 Oct 2002 19:40:00 -0000 1.50 --- sbin/mount/mount.c 7 Jan 2003 05:44:01 -0000 *************** *** 391,396 **** --- 391,399 ---- { /* List of directories containing mount_xxx subcommands. */ static const char *edirs[] = { + #ifdef RESCUE + _PATH_RESCUE, /* /rescue/mount tries /rescue first */ + #endif _PATH_SBIN, _PATH_USRSBIN, NULL Index: sbin/mount/pathnames.h =================================================================== RCS file: /mnt/cvs/src/sbin/mount/pathnames.h,v retrieving revision 1.1.1.1 diff -c -r1.1.1.1 pathnames.h *** sbin/mount/pathnames.h 26 May 1994 06:34:21 -0000 1.1.1.1 --- sbin/mount/pathnames.h 10 Dec 2002 05:34:02 -0000 *************** *** 33,38 **** --- 33,39 ---- * @(#)pathnames.h 8.2 (Berkeley) 3/27/94 */ + #define _PATH_RESCUE "/rescue" #define _PATH_SBIN "/sbin" #define _PATH_USRSBIN "/usr/sbin" #define _PATH_MOUNTDPID "/var/run/mountd.pid" Index: sbin/shutdown/pathnames.h =================================================================== RCS file: /mnt/cvs/src/sbin/shutdown/pathnames.h,v retrieving revision 1.2 diff -c -r1.2 pathnames.h *** sbin/shutdown/pathnames.h 17 May 2002 11:47:12 -0000 1.2 --- sbin/shutdown/pathnames.h 9 Jan 2003 04:21:08 -0000 *************** *** 36,41 **** #include ! #define _PATH_FASTBOOT "/fastboot" #define _PATH_HALT "/sbin/halt" #define _PATH_REBOOT "/sbin/reboot" --- 36,49 ---- #include ! /* No longer used? */ ! /* #define _PATH_FASTBOOT "/fastboot" */ ! ! /* Shouldn't these be moved into /usr/include/paths.h?? */ ! #ifndef RESCUE #define _PATH_HALT "/sbin/halt" #define _PATH_REBOOT "/sbin/reboot" + #else + #define _PATH_HALT "/rescue/halt" + #define _PATH_REBOOT "/rescue/reboot" + #endif Index: sbin/startslip/startslip.c =================================================================== RCS file: /mnt/cvs/src/sbin/startslip/startslip.c,v retrieving revision 1.34 diff -c -r1.34 startslip.c *** sbin/startslip/startslip.c 21 Mar 2002 13:20:48 -0000 1.34 --- sbin/startslip/startslip.c 1 Jan 2003 22:04:30 -0000 *************** *** 256,262 **** username, (long)conn_time); sprintf(buf, "LINE=%d %s %s down", diali ? (dialc - 1) % diali : 0, ! downscript ? downscript : "/sbin/ifconfig" , unitname); (void) system(buf); logged_in = 0; } --- 256,262 ---- username, (long)conn_time); sprintf(buf, "LINE=%d %s %s down", diali ? (dialc - 1) % diali : 0, ! downscript ? downscript : _PATH_IFCONFIG , unitname); (void) system(buf); logged_in = 0; } *************** *** 458,464 **** sprintf(buf, "LINE=%d %s %s up", diali ? (dialc - 1) % diali : 0, ! upscript ? upscript : "/sbin/ifconfig" , unitname); (void) system(buf); printd(", ready\n"); --- 458,464 ---- sprintf(buf, "LINE=%d %s %s up", diali ? (dialc - 1) % diali : 0, ! upscript ? upscript : _PATH_IFCONFIG , unitname); (void) system(buf); printd(", ready\n"); Index: sbin/vinum/commands.c =================================================================== RCS file: /mnt/cvs/src/sbin/vinum/commands.c,v retrieving revision 1.44 diff -c -r1.44 commands.c *** sbin/vinum/commands.c 16 Jan 2003 23:49:34 -0000 1.44 --- sbin/vinum/commands.c 24 Jan 2003 06:07:50 -0000 *************** *** 83,89 **** editor = getenv("EDITOR"); if (editor == NULL) ! editor = "/usr/bin/vi"; sprintf(tempfile, "/var/tmp/" VINUMMOD ".create.%d", getpid()); /* create a temp file */ tf = fopen(tempfile, "w"); /* open it */ if (tf == NULL) { --- 83,89 ---- editor = getenv("EDITOR"); if (editor == NULL) ! editor = _PATH_VI; sprintf(tempfile, "/var/tmp/" VINUMMOD ".create.%d", getpid()); /* create a temp file */ tf = fopen(tempfile, "w"); /* open it */ if (tf == NULL) { Index: share/mk/bsd.lib.mk =================================================================== RCS file: /mnt/cvs/src/share/mk/bsd.lib.mk,v retrieving revision 1.138 diff -c -r1.138 bsd.lib.mk *** share/mk/bsd.lib.mk 20 Sep 2002 19:32:51 -0000 1.138 --- share/mk/bsd.lib.mk 7 Jan 2003 02:01:16 -0000 *************** *** 21,26 **** --- 21,28 ---- SONAME?= ${SHLIB_NAME} .endif + CFLAGS+= ${CRUNCH_CFLAGS} + .if defined(DEBUG_FLAGS) CFLAGS+= ${DEBUG_FLAGS} .endif Index: share/mk/bsd.prog.mk =================================================================== RCS file: /mnt/cvs/src/share/mk/bsd.prog.mk,v retrieving revision 1.129 diff -c -r1.129 bsd.prog.mk *** share/mk/bsd.prog.mk 17 Oct 2002 13:48:13 -0000 1.129 --- share/mk/bsd.prog.mk 7 Jan 2003 02:01:20 -0000 *************** *** 6,11 **** --- 6,12 ---- .SUFFIXES: .out .o .c .cc .cpp .cxx .C .m .y .l .ln .s .S .asm CFLAGS+=${COPTS} ${DEBUG_FLAGS} + CFLAGS+= ${CRUNCH_CFLAGS} .if !defined(DEBUG_FLAGS) STRIP?= -s Index: usr.bin/vi/pathnames.h =================================================================== RCS file: /mnt/cvs/src/usr.bin/vi/pathnames.h,v retrieving revision 1.2 diff -c -r1.2 pathnames.h *** usr.bin/vi/pathnames.h 4 Nov 1996 02:28:31 -0000 1.2 --- usr.bin/vi/pathnames.h 22 Nov 2002 21:50:47 -0000 *************** *** 1,5 **** --- 1,8 ---- /* @(#)pathnames.h.in 8.4 (Berkeley) 6/26/96 */ + /* Read standard system paths first */ + #include + #ifndef _PATH_BSHELL #define _PATH_BSHELL "/bin/sh" #endif Index: usr.sbin/crunch/crunchgen/crunchgen.c =================================================================== RCS file: /mnt/cvs/src/usr.sbin/crunch/crunchgen/crunchgen.c,v retrieving revision 1.31 diff -c -r1.31 crunchgen.c *** usr.sbin/crunch/crunchgen/crunchgen.c 30 Mar 2002 16:48:30 -0000 1.31 --- usr.sbin/crunch/crunchgen/crunchgen.c 20 Nov 2002 04:07:07 -0000 *************** *** 691,705 **** fprintf(f, ".endif\n"); fprintf(f, "loop:\n\t@echo 'OBJS= '${%s}\n", objvar); ! fprintf(f, "crunchgen_objs:\n\t@make -f %s $(BUILDOPTS) $(%s_OPTS)", ! tempfname, p->ident); for (s = p->buildopts; s != NULL; s = s->next) fprintf(f, " %s", s->str); fprintf(f, " loop\n"); fclose(f); ! snprintf(line, MAXLINELEN, "make -f %s crunchgen_objs 2>&1", tempfname); if ((f = popen(line, "r")) == NULL) { warn("submake pipe"); goterror = 1; --- 691,708 ---- fprintf(f, ".endif\n"); fprintf(f, "loop:\n\t@echo 'OBJS= '${%s}\n", objvar); ! fprintf(f, "crunchgen_objs:\n\t@cd %s && make -f %s $(BUILDOPTS) $(%s_OPTS)", ! p->srcdir, tempfname, p->ident); for (s = p->buildopts; s != NULL; s = s->next) fprintf(f, " %s", s->str); fprintf(f, " loop\n"); fclose(f); ! snprintf(line, MAXLINELEN, "cd %s && make -f %s crunchgen_objs 2>&1", ! p->srcdir, ! tempfname); ! if ((f = popen(line, "r")) == NULL) { warn("submake pipe"); goterror = 1; *** /dev/null Thu Jan 23 22:33:00 2003 --- rescue/README Thu Jan 2 21:44:29 2003 *************** *** 0 **** --- 1,42 ---- + The /rescue build system here has three goals: + + 1) Produce a reliable standalone set of /rescue tools. + + The contents of /rescue are all statically linked and do not depend on + anything in /bin or /sbin. In particular, they'll continue to + function even if you've hosed your dynamic /bin and /sbin. For + example, note that /rescue/mount runs /rescue/mount_nfs and not + /sbin/mount_nfs. This is more subtle than it looks. + + As an added bonus, /rescue is fairly small (thanks to crunchgen) and + includes a number of tools (such as gzip, bzip2, vi) that are not + normally found in /bin and /sbin. + + 2) Demonstrate robust use of crunchgen. + + These Makefiles recompile each of the crunchgen components and include + support for overriding specific library entries. Such techniques + should be useful elsewhere. For example, boot floppies could use this + to conditionally compile out features to reduce executable size. + + 3) Produce a toolkit suitable for small distributions. + + Install /rescue on a CD or CompactFlash disk, and symlink /bin and + /sbin to /rescue to produce a small and fairly complete FreeBSD + system. + + These tools have one big disadvantage: being statically linked, they + cannot use some advanced library functions that rely on dynamic + linking. In particular, nsswitch, locales, and pam are likely to all + rely on dynamic linking in the near future. + + + To compile: + + # cd /usr/src/rescue + # make obj + # make + # make install + + Note that rebuilds don't always work correctly; if you run into + trouble, try 'make clean' before recompiling. *** /dev/null Thu Jan 23 22:33:00 2003 --- rescue/Makefile Wed Jan 8 18:41:52 2003 *************** *** 0 **** --- 1,3 ---- + SUBDIR=librescue rescue + + .include *** /dev/null Thu Jan 23 22:33:00 2003 --- rescue/librescue/Makefile Thu Jan 23 21:48:13 2003 *************** *** 0 **** --- 1,36 ---- + # + # $FreeBSD: src/rescue/librescue/Makefile,v Exp $ + # + + # Certain library entries have hard-coded references to + # /bin, /sbin, etc, that require those entries to be + # recompiled for use in /rescue. This Makefile + # accomplishes that. Note that this is pure build hackery. + # This library should never be installed, and isn't even linked + # with in the normal way. (See ../rescue/Makefile for details.) + + LIB= rescue + NOPROFILE= yes # Don't generate profile version + INTERNALLIB= yes # Don't install this library + + CFLAGS+= -DRESCUE + # Flags copied from src/lib/libc and src/lib/libutil + CFLAGS+= -I${.CURDIR}/../../lib/libc/include + CFLAGS+= -I${.CURDIR}/../../include + CFLAGS+= -D__DBINTERFACE_PRIVATE + CFLAGS+= -DINET6 + CFLAGS+= -I${.OBJDIR}/../../lib/libc + CFLAGS+= -DPOSIX_MISTAKE + CFLAGS+= -I${.CURDIR}/../../lib/libc/locale + CFLAGS+= -DBROKEN_DES + CFLAGS+= -DPORTMAP + CFLAGS+= -DDES_BUILTIN + CFLAGS+= -DYP + CFLAGS+= -DHESIOD + CFLAGS+= -Wall -Wwrite-strings -Wpointer-arith + + .PATH: ${.CURDIR}/../../lib/libc/gen ${.CURDIR}/../../lib/libutil ${.CURDIR}/../../lib/libc/net ${.CURDIR}/../../lib/libc/stdlib + + SRCS = exec.c getusershell.c login_class.c popen.c rcmdsh.c sysctl.c system.c + + .include *** /dev/null Thu Jan 23 22:33:00 2003 --- rescue/rescue/Makefile Wed Jan 8 20:25:05 2003 *************** *** 0 **** --- 1,259 ---- + # $FreeBSD: src/rescue/Makefile Exp $ + # @(#)Makefile 8.1 (Berkeley) 6/2/93 + + PROG= rescue + BINDIR?= /rescue + + # Uncomment to exclude tcsh + #NO_TCSH=1 + + # Shell scripts need #! line to be edited from /bin/sh to /rescue/sh + SCRIPTS= nextboot_FIXED + SCRIPTSNAME_nextboot_FIXED= nextboot.sh + nextboot_FIXED: ../../sbin/reboot/nextboot.sh + sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET} + CLEANFILES+= nextboot_FIXED + + SCRIPTS+= dhclient_FIXED + SCRIPTSNAME_dhclient_FIXED= dhclient-script + dhclient_FIXED: ../../contrib/isc-dhcp/client/scripts/freebsd + sed '1s/\/bin\//\/rescue\//' ${.ALLSRC} > ${.TARGET} + CLEANFILES+= dhclient_FIXED + + ################################################################# + # + # General notes: + # + # A number of Make variables are used to generate the crunchgen config file. + # + # CRUNCH_SRCDIRS: lists directories to search for included programs + # CRUNCH_PROGS: lists programs to be included + # CRUNCH_LIBS: libraries to link with + # CRUNCH_BUILDOPTS: generic build options to be added to every program + # + # Special options can be specified for individual programs + # CRUNCH_SRCDIR_$(P): base source directory for program $(P) + # CRUNCH_BUILDOPTS_$(P): additional build options for $(P) + # CRUNCH_ALIAS_$(P): additional names to be used for $(P) + # + # By default, any name appearing in CRUNCH_PROGS or CRUNCH_ALIAS_${P} + # will be used to generate a hard link to the resulting binary. + # Specific links can be suppressed by setting + # CRUNCH_SUPPRESS_LINK_$(NAME) to 1. + # + + # Define Makefile variable RESCUE + CRUNCH_BUILDOPTS+= -DRESCUE + # Define compile-time RESCUE symbol when compiling components + CRUNCH_BUILDOPTS+= CRUNCH_CFLAGS=-DRESCUE + + # Hackery: 'librescue' exists merely as a tool for appropriately + # recompiling specific library entries. We _know_ they're needed, and + # regular archive searching creates ugly library ordering problems. + # Easiest fix: tell the linker to include them into the executable + # first, so they are guaranteed to override the regular lib entries. + # Note that if 'librescue' hasn't been compiled, we'll just get the + # regular lib entries from libc and friends. + CRUNCH_LIBS+= ${.OBJDIR}/../librescue/*.o + + ################################################################### + # Programs from stock /bin + # + # WARNING: Changing this list may require adjusting + # /usr/include/paths.h as well! You were warned! + # + CRUNCH_SRCDIRS+=$(.CURDIR)/../../bin $(.CURDIR)/../../usr.bin + CRUNCH_PROGS=cat chflags chio chmod cp date dd df domainname echo ed \ + expr getfacl hostname kenv kill ln ls mkdir mv pax ps pwd \ + realpath rm rmdir setfacl sh sleep stty sync test + CRUNCH_LIBS+=-lcrypt -ledit -lkvm -ll -lm -ltermcap -lutil + + # Additional options for specific programs + CRUNCH_ALIAS_test= [ + CRUNCH_ALIAS_sh= -sh + # The -sh alias shouldn't appear in /rescue as a hard link + CRUNCH_SUPPRESS_LINK_-sh=1 + CRUNCH_ALIAS_ln= link + CRUNCH_ALIAS_rm= unlink + CRUNCH_ALIAS_ed= red + + .if !defined(NO_RCMNDS) + CRUNCH_PROGS+= rcp + .endif + + .if !defined(NO_TCSH) + CRUNCH_PROGS+= csh + CRUNCH_ALIAS_csh= -csh tcsh -tcsh + CRUNCH_SUPPRESS_LINK_-csh=1 + CRUNCH_SUPPRESS_LINK_-tcsh=1 + .endif + + #Is rmail of any use at all here? I think not. + #CRUNCH_PROGS+= rmail + + ################################################################### + # Programs from standard /sbin + # + # WARNING: Changing this list may require adjusting + # /usr/include/paths.h as well! You were warned! + # + # Note that mdmfs and shutdown have their own private 'pathnames.h' + # headers in addition to the standard 'paths.h' header. + # + CRUNCH_SRCDIRS+=$(.CURDIR)/../../sbin + CRUNCH_PROGS+=atm adjkerntz atacontrol badsect camcontrol ccdconfig \ + clri comcontrol conscontrol devfs disklabel dmesg dump \ + dumpfs dumpon fdisk fore_dnld fsck fsck_ffs fsck_msdosfs fsdb \ + fsirand gbde growfs ifconfig ilmid init ip6fw ipf ipfs ipfstat \ + ipfw ipmon ipnat kldconfig kldload kldstat kldunload ldconfig \ + md5 mdconfig mdmfs mknod mount mount_cd9660 mount_ext2fs \ + mount_msdosfs mount_nfs mount_ntfs mount_nullfs mount_portalfs \ + mount_std mount_udf mount_umapfs mount_unionfs natd newfs \ + newfs_msdos nfsiod nos-tun ping ping6 quotacheck raidctl reboot \ + restore rcorder route routed rtquery rtsol savecore shutdown \ + slattach spppcontrol startslip swapon sysctl tunefs umount vinum + + # crunchgen does not like C++ programs; this should be fixed someday + # CRUNCH_PROGS+= devd + + CRUNCH_LIBS+=-lalias -latm -lcam -lcurses -ldevstat -lipsec -lipx -lmd \ + -lncp -lreadline -lsbuf -lsmb -lufs -lz + + .if ${MACHINE_ARCH} == "i386" + CRUNCH_PROGS+= cxconfig mount_nwfs mount_smbfs + .endif + + .if ${MACHINE} == "pc98" + CRUNCH_PROGS+= fdisk_pc98 + .endif + + .if ${MACHINE_ARCH} == "ia64" + CRUNCH_PROGS+= mca gpt + .endif + + .if ${MACHINE_ARCH} == "sparc" + .endif + + .if ${MACHINE_ARCH} == "alpha" + .endif + + CRUNCH_SRCDIR_atm=$(.CURDIR)/../../sbin/atm/atm + CRUNCH_SRCDIR_fore_dnld=$(.CURDIR)/../../sbin/atm/fore_dnld + CRUNCH_SRCDIR_ilmid=$(.CURDIR)/../../sbin/atm/ilmid + CRUNCH_SRCDIR_rtquery=$(.CURDIR)/../../sbin/routed/rtquery + CRUNCH_ALIAS_reboot= fastboot halt fasthalt + CRUNCH_ALIAS_restore=rrestore + CRUNCH_ALIAS_dump= rdump + CRUNCH_ALIAS_fsck_ffs=fsck_4.2bsd fsck_ufs + CRUNCH_ALIAS_mount_std= mount_devfs mount_fdescfs mount_linprocfs mount_procfs + + # dhclient has historically been troublesome... + CRUNCH_PROGS+=dhclient + CRUNCH_BUILDOPTS_dhclient=-DRELEASE_CRUNCH -Dlint + + ################################################################## + # Programs from stock /usr/bin + # + CRUNCH_SRCDIRS+=$(.CURDIR)/../../usr.bin + CRUNCH_SRCDIRS+=$(.CURDIR)/../../gnu/usr.bin + + CRUNCH_PROGS+=wall + + CRUNCH_PROGS+=gzip + CRUNCH_ALIAS_gzip=gunzip gzcat zcat + + CRUNCH_PROGS+=bzip2 + CRUNCH_ALIAS_bzip2=bunzip2 bzcat + CRUNCH_LIBS+=-lbz2 + + CRUNCH_PROGS+=tar + CRUNCH_PROGS+=vi + CRUNCH_ALIAS_vi=ex + + ################################################################## + # The following is pretty nearly a generic crunchgen-handling makefile + # + + CONF= $(PROG).conf + OUTMK= $(PROG).mk + OUTC= $(PROG).c + OUTPUTS= $(OUTMK) $(OUTC) $(PROG).cache + CRUNCHOBJS= ${.OBJDIR} + .if defined(MAKEOBJDIRPREFIX) + CANONICALOBJDIR:=${MAKEOBJDIRPREFIX}${.CURDIR} + .else + CANONICALOBJDIR:=/usr/obj${.CURDIR} + .endif + + NOMAN= true + CLEANFILES+= $(CONF) *.o *.lo *.c *.mk *.cache *.a *.h + + # Program names and their aliases contribute hardlinks to 'rescue' executable, + # except for those that get suppressed. + .for P in $(CRUNCH_PROGS) + .ifndef CRUNCH_SUPPRESS_LINK_${P} + LINKS += $(BINDIR)/$(PROG) $(BINDIR)/$(P) + .endif + .for A in $(CRUNCH_ALIAS_$(P)) + .ifndef CRUNCH_SUPPRESS_LINK_${A} + LINKS += $(BINDIR)/$(PROG) $(BINDIR)/$(A) + .endif + .endfor + .endfor + + all: $(PROG) + exe: $(PROG) + + $(CONF): Makefile + echo \# Auto-generated, do not edit >$(.TARGET) + .for D in $(CRUNCH_SRCDIRS) + echo srcdirs $(D) >>$(.TARGET) + .endfor + .ifdef CRUNCH_BUILDOPTS + echo buildopts $(CRUNCH_BUILDOPTS) >>$(.TARGET) + .endif + .ifdef CRUNCH_BUILDOPTS + echo libs $(CRUNCH_LIBS) >>$(.TARGET) + .endif + .for P in $(CRUNCH_PROGS) + echo progs $(P) >>$(.TARGET) + .ifdef CRUNCH_SRCDIR_${P} + echo special $(P) srcdir $(CRUNCH_SRCDIR_${P}) >>$(.TARGET) + .endif + .ifdef CRUNCH_BUILDOPTS_${P} + echo special $(P) buildopts $(CRUNCH_BUILDOPTS_${P}) >>$(.TARGET) + .endif + .for A in $(CRUNCH_ALIAS_$(P)) + echo ln $(P) $(A) >>$(.TARGET) + .endfor + .endfor + + + $(OUTPUTS): $(CONF) + MAKEOBJDIRPREFIX=${CRUNCHOBJS} crunchgen -q -m $(OUTMK) -c $(OUTC) $(CONF) + + $(PROG): $(OUTPUTS) + MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) + + objs: + MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) objs + + # Use a separate build tree to hold files compiled for this crunchgen binary + # Yes, this does seem to partly duplicate bsd.subdir.mk, but I can't + # get that to cooperate with bsd.prog.mk. Besides, many of the standard + # targets should NOT be propagated into the components. + cleandepend cleandir obj objlink: + .for D in $(CRUNCH_SRCDIRS) + cd ${D} && MAKEOBJDIRPREFIX=${CANONICALOBJDIR} make ${.TARGET} + .endfor + + clean: + if [ -e ${.OBJDIR}/$(OUTMK) ]; then \ + MAKEOBJDIRPREFIX=${CRUNCHOBJS} make -f $(OUTMK) clean; \ + fi + .for D in $(CRUNCH_SRCDIRS) $(EXTRA_SRCDIRS) + cd ${D} && MAKEOBJDIRPREFIX=${CRUNCHOBJS} make clean + .endfor + rm -f ${CLEANFILES} + + .include --------------030407000308050805040706-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message ----Next_Part(Thu_May__8_09:42:06_2003_428)----