changeset 556:dea7c4365bbe

core/busybox: add options, closes #1664 While here, disable inittab parsing because it has a different syntax than sysvinit and is not compatible. To avoid conflict and frustration use busybox's default actions and let user install sysvinit for more customizations.
author David Demelier <markand@malikania.fr>
date Fri, 05 Jul 2019 20:20:00 +0200
parents e51af292bfd9
children 73e25417284b
files core/busybox/busybox.sh core/busybox/config
diffstat 2 files changed, 43 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/core/busybox/busybox.sh	Thu Jul 04 20:18:00 2019 +0200
+++ b/core/busybox/busybox.sh	Fri Jul 05 20:20:00 2019 +0200
@@ -21,10 +21,15 @@
 PKGLICENSE="GPLv2"
 PKGSUMMARY="swiss army knife for embedded"
 PKGDOWNLOAD="https://busybox.net/downloads/$PKGNAME-$PKGVERSION.tar.bz2"
+PKGOPTIONS="CONFIG IPV6 PAM SELINUX"
 
 : ${CC:=clang}
 : ${CFLAGS:=-O2}
 : ${LDFLAGS:=}
+: ${CONFIG:=}
+: ${IPV6:=yes}
+: ${SELINUX:=no}
+: ${PAM:=no}
 
 build()
 {
@@ -32,7 +37,43 @@
 	tar xvaf $PKGNAME-$PKGVERSION.tar.bz2
 	pushd $PKGNAME-$PKGVERSION
 
-	cp ../config .config
+	#
+	# Allow user to specify a full config if specified, otherwise change
+	# package options.
+	#
+	if [ -n "$CONFIG" ] && [ -r "$CONFIG" ]; then
+		cp $CONFIG .config
+
+		#
+		# When specifying a config file, force other selective options
+		# to a dummy value to avoid incorrect information in package
+		# file.
+		#
+		IPV6=""
+		SELINUX=""
+		PAM=""
+	else
+		cp ../config .config
+
+		if [ "$SELINUX" = "yes" ]; then
+			echo "CONFIG_SELINUX=y" >> .config
+			echo "CONFIG_FEATURE_TAR_SELINUX=y" >> .config
+			echo "CONFIG_SELINUXENABLED=y" >> .config
+		fi
+
+		if [ "$PAM" = "yes" ]; then
+			echo "CONFIG_PAM=y" >> .config
+		fi
+
+		if [ "$IPV6" != "yes" ]; then
+			sed -i -e "/CONFIG_FEATURE_IPV6=y/ s/y/n/" .config
+			sed -i -e "/CONFIG_FEATURE_IFUPDOWN_IPV6=y/ s/y/n/" .config
+		fi
+	fi
+
+	# Our start script is located in /etc/rc.d/rc.init.
+	sed -i -e 's|/etc/init.d/rcS|/etc/rc.d/rc.init|' init/init.c
+
 	make CC="$CC" HOSTCC="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS"
 	install -Dm0755 busybox $DESTDIR/bin/busybox
 	install -Dm0644 ../busybox.crond $DESTDIR/etc/rc.d/busybox.crond
--- a/core/busybox/config	Thu Jul 04 20:18:00 2019 +0200
+++ b/core/busybox/config	Fri Jul 05 20:20:00 2019 +0200
@@ -492,7 +492,7 @@
 CONFIG_TELINIT_PATH=""
 CONFIG_INIT=y
 CONFIG_LINUXRC=y
-CONFIG_FEATURE_USE_INITTAB=y
+CONFIG_FEATURE_USE_INITTAB=n
 # CONFIG_FEATURE_KILL_REMOVED is not set
 CONFIG_FEATURE_KILL_DELAY=0
 CONFIG_FEATURE_INIT_SCTTY=y