Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Jan 2001 10:39:40 +0100
From:      alex@big.endian.de (Alexander Langer)
To:        audit@freebsd.org
Subject:   oinit with compile time option shell/init script
Message-ID:  <20010119103939.A8500@cichlids.cichlids.com>

next in thread | raw e-mail | index | archive | help
Hello!

I'd like to change oinit so that you can give the init-script as
compile-time option.  This way it can be abused for other uses as
picobsd.

cvs server: Diffing .
Index: Makefile
===================================================================
RCS file: /home/ncvs/src/release/picobsd/tinyware/oinit/Makefile,v
retrieving revision 1.2
diff -u -r1.2 Makefile
--- Makefile	1999/08/28 01:33:57	1.2
+++ Makefile	2001/01/19 09:38:53
@@ -1,9 +1,19 @@
 # $FreeBSD: src/release/picobsd/tinyware/oinit/Makefile,v 1.2 1999/08/28 01:33:57 peter Exp $
 #
-PROG=oinit
-#CFLAGS+=-DUSE_HISTORY
-CFLAGS+=-DOINIT_RC=\"/etc/oinit.rc\"
-#LDADD=-lutil -ledit -ltermcap
+PROG=		oinit
+
+SH_PATH?=	/bin/sh
+SH_NAME?=	-sh
+SH_ARG?=	/etc/rc
+
+CFLAGS=		-DSH_PATH=\"${SH_PATH}\" -DSH_NAME=\"${SH_NAME}\" \
+		-DSH_ARG=\"${SH_ARG}\"
+
+
+#CFLAGS+=	-DUSE_HISTORY
+#CFLAGS+=	-DOINIT_RC=\"/etc/oinit.rc\"
+
+#LDADD=		-lutil -ledit -ltermcap
 LDADD=-lutil
 NOMAN=yes
 
Index: oinit.c
===================================================================
RCS file: /home/ncvs/src/release/picobsd/tinyware/oinit/oinit.c,v
retrieving revision 1.5
diff -u -r1.5 oinit.c
--- oinit.c	2000/12/09 09:35:37	1.5
+++ oinit.c	2001/01/19 09:38:54
@@ -599,6 +599,15 @@
  * normal /etc/rc interpreted by Bourne shell.
  */
 #ifndef OINIT_RC
+#ifndef SH_NAME
+#define SH_NAME	"-sh"
+#endif
+#ifndef SH_PATH
+#define SH_PATH _PATH_BSHELL
+#endif
+#ifndef SH_ARG
+#define SH_ARG	"/etc/rc"
+#endif
 void
 runcom()
 {
@@ -617,10 +626,10 @@
 		dup2(fd,1);
 		dup2(fd,2);
 		if(fd>2) close(fd);
-		argv[0]="-sh";
-		argv[1]="/etc/rc";
+		argv[0]=SH_NAME;
+		argv[1]=SH_ARG;
 		argv[2]=0;
-		execvp("/bin/sh",argv);
+		execvp(SH_PATH,argv);
 		printf("runcom(): %s\n",strerror(errno));
 		_exit(1);
 	}
-- 
cat: /home/alex/.sig: No such file or directory


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




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