Subject: install/17676: New step to change root shell
To: None <gnats-bugs@gnats.netbsd.org>
From: Julio Merino <jmmv@hispabsd.org>
List: netbsd-bugs
Date: 07/22/2002 14:13:44
>Number:         17676
>Category:       install
>Synopsis:       New step to change root shell
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    install-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 22 05:13:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Julio Merino
>Release:        NetBSD 1.6D
>Organization:
HispaBSD
>Environment:
	
	
System: NetBSD darkstar.local 1.6D NetBSD 1.6D (DARKSTAR) #0: Mon Jul 22 12:44:12 CEST 2002 jmmv@darkstar.local:/var/build/kernel/DARKSTAR i386
Architecture: i386
Machine: i386
>Description:
	The TODO list of sysinst says that it should include a step to change
	the root shell during the installation. The following patch adds this
	new step after setting root's password, and the default value is
	/bin/csh, as usual for root.
>How-To-Repeat:
	
>Fix:

Index: TODO
===================================================================
RCS file: /pub/NetBSD-CVS/basesrc/distrib/utils/sysinst/TODO,v
retrieving revision 1.20
diff -u -u -r1.20 TODO
--- TODO	2001/12/13 14:02:02	1.20
+++ TODO	2002/07/22 12:07:33
@@ -104,8 +104,6 @@
 
 	-- Full configuration of rc.conf?
 
-	-- Set root's shell
-
 	-- If we're doing a fresh install and there's already a label
 	   on the disk, maybe use that instead of the compiled-in default
 	   label?
Index: defs.h
===================================================================
RCS file: /pub/NetBSD-CVS/basesrc/distrib/utils/sysinst/defs.h,v
retrieving revision 1.70
diff -u -u -r1.70 defs.h
--- defs.h	2002/06/06 09:53:22	1.70
+++ defs.h	2002/07/22 12:07:36
@@ -361,6 +361,7 @@
 int	set_timezone (void);
 int	set_crypt_type (void);
 int	set_root_password (void);
+int	set_root_shell (void);
 void	scripting_fprintf(FILE *, const char *, ...);
 void	scripting_vfprintf(FILE *, const char *, va_list);
 void	add_rc_conf(const char *, ...);
Index: install.c
===================================================================
RCS file: /pub/NetBSD-CVS/basesrc/distrib/utils/sysinst/install.c,v
retrieving revision 1.28
diff -u -u -r1.28 install.c
--- install.c	2002/04/04 14:26:44	1.28
+++ install.c	2002/07/22 12:07:36
@@ -141,6 +141,7 @@
 	set_crypt_type();
 
 	set_root_password();
+	set_root_shell();
 	
 	sanity_check();
 
Index: msg.mi.en
===================================================================
RCS file: /pub/NetBSD-CVS/basesrc/distrib/utils/sysinst/msg.mi.en,v
retrieving revision 1.88
diff -u -u -r1.88 msg.mi.en
--- msg.mi.en	2002/06/02 14:12:54	1.88
+++ msg.mi.en	2002/07/22 12:07:43
@@ -844,6 +844,12 @@
 {The root password of the newly installed system has not yet been initialized,
 and is thus empty.  Do you want to set a root password for the system now?}
 
+message rootsh
+{The root shell defaults to /bin/csh. Do you want to change it now?}
+
+message rootsh_path
+{Insert the full path of root's shell}
+
 message label_size_special
 {
 Special values that can be entered for the size value:
Index: util.c
===================================================================
RCS file: /pub/NetBSD-CVS/basesrc/distrib/utils/sysinst/util.c,v
retrieving revision 1.72
diff -u -u -r1.72 util.c
--- util.c	2002/06/29 20:04:56	1.72
+++ util.c	2002/07/22 12:07:48
@@ -1107,6 +1107,21 @@
 	return 0;
 }
 
+int
+set_root_shell()
+{
+	char shell[STRSIZE];
+
+	msg_display(MSG_rootsh);
+	process_menu(MENU_yesno);
+	if (yesno) {
+		msg_prompt(MSG_rootsh_path, "/bin/csh", shell, STRSIZE);
+		run_prog(RUN_DISPLAY|RUN_CHROOT, NULL, "chpass -s %s root",
+		         shell);
+	}
+	return 0;
+}
+
 void
 scripting_vfprintf(FILE *f, const char *fmt, va_list ap)
 {
>Release-Note:
>Audit-Trail:
>Unformatted: