Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 May 2009 00:30:15 -0700
From:      perryh@pluto.rain.com
To:        invalid.pointer@gmail.com
Cc:        freebsd-questions@freebsd.org
Subject:   Re: How to move vi to /bin
Message-ID:  <4a0d1a07.fZIhzrRdPEy8LIdq%perryh@pluto.rain.com>
In-Reply-To: <4A0D0FD6.4040107@gmail.com>
References:  <cb0fa7b70905130021t390bb560r4a1dd64ab3b2e79@mail.gmail.com> <200905142019.56242.mel.flynn%2Bfbsd.questions@mailing.thruhere.net> <4A0D0FD6.4040107@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Manish Jain <invalid.pointer@gmail.com> wrote:
> From all the discussion I have walked through on the issue of
> where to place vi, it does appear FreeBSD has a skewed policy
> on the issue. There are plenty of reasons you might need access
> an editor in single-user mode - editing  fstab is just one.
> Having to use the workarounds suggested in place of vi is not
> so good, and manually moving vi to /bin is not simply a matter
> of 'mv /usr/bin/vi /bin/'.
>
> One of the things I would dearly like to see in a future release
> is vi being placed under /bin.

Maybe put something like this [untested] in /bin/vi:

#!/bin/sh
[ -x /usr/bin/vi ] && exec /usr/bin/vi "$@"
exec /rescue/vi "$@"

That should run /usr/bin/vi if it's available, else fall back to
/rescue/vi.  Beats linking /rescue/vi into /bin, since that would
cause the statically-linked version to be used by anyone who has
/bin ahead of /usr/bin in PATH, even when the dynamically-linked
version is available.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4a0d1a07.fZIhzrRdPEy8LIdq%perryh>