From owner-freebsd-hackers@FreeBSD.ORG Mon Sep 3 15:02:50 2007 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04ECA16A421 for ; Mon, 3 Sep 2007 15:02:50 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from woozle.rinet.ru (woozle.rinet.ru [195.54.192.68]) by mx1.freebsd.org (Postfix) with ESMTP id 72C5413C45D for ; Mon, 3 Sep 2007 15:02:49 +0000 (UTC) (envelope-from marck@rinet.ru) Received: from localhost (localhost [127.0.0.1]) by woozle.rinet.ru (8.14.1/8.14.1) with ESMTP id l83El3rM055217; Mon, 3 Sep 2007 18:47:03 +0400 (MSD) (envelope-from marck@rinet.ru) Date: Mon, 3 Sep 2007 18:47:03 +0400 (MSD) From: Dmitry Morozovsky To: Julian Stacey In-Reply-To: <200709011240.l81CeTKd056036@fire.js.berklix.net> Message-ID: <20070903184218.B52310@woozle.rinet.ru> References: <200709011240.l81CeTKd056036@fire.js.berklix.net> X-NCC-RegID: ru.rinet X-OpenPGP-Key-ID: 6B691B03 MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=KOI8-r Content-Transfer-Encoding: 8BIT X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (woozle.rinet.ru [0.0.0.0]); Mon, 03 Sep 2007 18:47:04 +0400 (MSD) Cc: Yar Tikhiy , hackers@freebsd.org Subject: Re: Useful tools missing from /rescue X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Sep 2007 15:02:50 -0000 On Sat, 1 Sep 2007, Julian Stacey wrote: JS> > I've had to use /rescue recently and felt lack of a few basic tools JS> > in it, namely pgrep(1), head(1), tail(1), tee(1), and a text filter, JS> > e.g., sed(1). Well, in fact most functionality of pgrep(1), head(1), JS> > tail(1), and even tee(1) can be emulated if one has sed(1), but the JS> > tools are so tiny and convenient that it's a pity not to have them JS> > all handy during hard times. JS> > JS> > In addition, there are chflags and chmod in /rescue, but there's JS> > no chown in it, so the toolset is a bit incomplete. JS> > JS> > Would anyone mind if I add those tools to /rescue? The size growth JS> > will be rather small: JS> > JS> > -r-xr-xr-x 121 root wheel 3715096 1 ΣΕΞ 10:22 /mnt2/rescue.old/rescue JS> > -r-xr-xr-x 129 root wheel 3761828 1 ΣΕΞ 11:22 /mnt2/rescue/rescue JS> JS> Don't do it without approval of re@ (who might be too busy just now JS> anyway) It might blow the limit on the tight packed rescue floppy. JS> (& though desk workstations have CDs, lost of small boxes still JS> just have floppies for rescue) Best try to build a rescue floppy JS> yourself before adding bloat. JS> JS> BTW I've never used pgrep thus superfluous to rescue. Others also JS> not really needed, merely nice. True rescue is just to fix FS at JS> which point you can mount other FS or CDROM or NFS etc for more JS> tools. What about adding support for zfs then (see below)? I found it especially useful when you have zfs-on-root and copy /rescue to /bootdisk and symlink bin and sbin to rescue - this allows emergency management of zfs when booting with /bootdisk as root. Trick with -lm seems to be needed because libzfs itself refers to pow(3) - or did I miss something trivial to resolve this? Sincerely, D.Marck [DM5020, MCK-RIPE, DM3-RIPN] [ FreeBSD committer: marck@FreeBSD.org ] ------------------------------------------------------------------------ *** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck@rinet.ru *** ------------------------------------------------------------------------ Index: Makefile =================================================================== RCS file: /home/ncvs/src/rescue/rescue/Makefile,v retrieving revision 1.56 diff -u -r1.56 Makefile --- Makefile 14 Jul 2007 21:49:22 -0000 1.56 +++ Makefile 31 Aug 2007 11:24:34 -0000 @@ -71,7 +71,7 @@ CRUNCH_PROGS_bin= cat chflags chio chmod cp date dd df echo \ ed expr getfacl hostname kenv kill ln ls mkdir mv pax ps pwd \ realpath rm rmdir setfacl sh stty sync test -CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -lm -ltermcap -lutil +CRUNCH_LIBS+= -lcrypt -ledit -lkvm -ll -ltermcap -lutil .if ${MK_OPENSSL} != "no" CRUNCH_LIBS+= -lcrypto .endif @@ -185,5 +185,17 @@ CRUNCH_PROGS_sbin+= dhclient CRUNCH_BUILDOPTS_dhclient= -DRELEASE_CRUNCH -Dlint +# zfs-related: zpool and zfs +.if ${MK_CDDL} != "no" && ${MK_ZFS} != "no" +CRUNCH_PROGS_sbin+= zfs zpool +CRUNCH_SRCDIR_zfs= $(.CURDIR)/../../cddl/sbin/zfs +CRUNCH_SRCDIR_zpool= $(.CURDIR)/../../cddl/sbin/zpool +CRUNCH_LIBS+= -lzfs -lavl -lnvpair -luutil +.endif + +# XXX libzfs needs pow() +CRUNCH_LIBS+= -lm + ################################################################## # Programs from stock /usr/bin #