Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Apr 1999 14:49:08 -0400 (EDT)
From:      "Crist J. Clark" <cjc@cc942873-a.ewndsr1.nj.home.com>
To:        sue@welearn.com.au (Sue Blake)
Cc:        dm@k12-nis-2.bbn.com, freebsd-questions@FreeBSD.ORG
Subject:   Re: login shell selection prompt
Message-ID:  <199904101849.OAA13769@cc942873-a.ewndsr1.nj.home.com>
In-Reply-To: <19990410222804.05084@welearn.com.au> from Sue Blake at "Apr 10, 99 10:28:04 pm"

next in thread | previous in thread | raw e-mail | index | archive | help
Sue Blake wrote,

Hi, Sue!

> On Fri, Apr 09, 1999 at 07:51:59PM -0400, david mankins wrote:
> >> 
> >> Date: Sat, 10 Apr 1999 04:51:40 +1000
> >> From: Sue Blake <sue@welearn.com.au>
> >> 
> >> When booting in single-user mode, root is asked to select which shell
> >> to use at login. I'd like to get that prompt at login for a normal
> >> user.
> >> 
> >> I don't want to load a shell and then have the user change it, because
> >> I'm trying to save a few bytes of memory when arriving to soothe a
> >> choking 386.
> >> 
> >> Is it easy to set this up somewhere? A man page name would be enough.

This seems easy enough to do with a shells script[0], but...

> So... the normal shell loads and uses memory, then the second shell
> loads and uses more memory? Actually I thought with exec the first
> shell gets ditched and replaced by the second less hungry shell, but
> it's still too late mate. The first shell has already gobbled up those
> few extra bytes of memory, and that could be enough to upset the ailing
> machine.

You say that an 'exec' is not good enough. You seem to indicate that a
brief moment during an exec when both the original shell and the new
one being fired up might exist in memory together might be too much
for your lil' 386. I'm not exactly sure of the memory dynamics of a
shell's exec command and whether that is a real concern, but a way to
get around it would be a simple C program of your own.

> Does anyone happen to know for sure if there is or is not a way to do it?
> Or does anyone know what it is that's responsible for presenting that
> shell question in single user mode? I might be able to work it out from
> there.

The single user prompting takes place in 'init.' See the source in,

    /usr/src/sbin/init/init.c

And look for the single_user() function.

[0] It's just such an easy script,

#!/bin/sh

echo -n "Enter full pathname of shell or RETURN for /bin/sh: "
read USER_SHELL
exec $USER_SHELL

# Only reached on error
echo "Bad pathname"
exit 1

-- 
Crist J. Clark                           cjclark@home.com


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199904101849.OAA13769>