home: hub: mkinitfs

Download patch

ref: 6aba975e73e7cea833640e8db180c0add01ecf33
parent: f9796dc318ddbf24f8f1fad67aeaea07fe416bd9
parent: 3c0420ee47d4389f4e6b8faeb109b0901835898f
author: Natanael Copa <ncopa@alpinelinux.org>
date: Tue Oct 20 04:22:06 CDT 2015

Merge branch 'master' into nlplug-findfs

--- a/bootchartd.in
+++ b/bootchartd.in
@@ -46,7 +46,7 @@
 	# Enable process accounting if configured
 	if [ "$PROCESS_ACCOUNTING" = "yes" ]; then
 		[ -e kernel_pacct ] || : > kernel_pacct
-		accton kernel_pacct
+		accton kernel_pacct > /dev/null
 	fi
 
 	# open file descriptors
@@ -98,7 +98,7 @@
 		i=$(($i + 1))
 	done
 
-	[ -e kernel_pacct ] && accton
+	[ -e kernel_pacct ] && accton off > /dev/null
 }
 
 # Stop the boot logger.  The lock file is removed to force the loggers in
@@ -151,19 +151,18 @@
 
 	# Package log files
 	tar -zcf "$BOOTLOG_DEST" header $pacct *.log
-	rm "$LOGDIR"/*
-	rmdir "$LOGDIR"
+	rm -rf "$LOGDIR"
 }
 
 case "$1" in
 start-initfs)
 	NEWROOT="$2"
+	mkdir -p "$LOGDIR"
 	(
 		cleanup=true
 		trap "not_stop_logging=false" USR1
 		trap "cleanup=false; not_stop_logging=false" USR2
 
-		mkdir "$LOGDIR"
 		cd "$LOGDIR"
 		do_logging
 		if $cleanup; then
@@ -171,18 +170,16 @@
 			finalize
 		fi
 	) &
-	echo $! > $LOGDIR/bootchart.pid
+	echo $! > "$LOGDIR"/bootchart.pid
 	;;
 stop-initfs)
 	NEWROOT="$2"
-
-	cd "$LOGDIR"
-	mkdir "$NEWROOT$LOGDIR"
-	cp /sbin/bootchartd $NEWROOT/sbin
-	PID=`cat bootchart.pid`
+	[ -x "$NEWROOT"/sbin/bootchartd ] || cp -a /sbin/bootchartd "$NEWROOT"/sbin
+	rm -rf "$NEWROOT/$LOGDIR"
+	PID=$(cat "$LOGDIR"/bootchart.pid)
 	kill -USR2 $PID
 	wait $PID
-	mv * "$NEWROOT$LOGDIR"
+	mv "$LOGDIR" "$NEWROOT"
 	;;
 start-rootfs)
 	(
--- a/features.d/bootchart.files
+++ b/features.d/bootchart.files
@@ -1,3 +1,4 @@
+/sbin/bootchartd
 /usr/bin/ac
 /usr/bin/last
 /usr/bin/lastcomm
@@ -5,4 +6,3 @@
 /usr/sbin/dump-acct
 /usr/sbin/accton
 /usr/sbin/sa
-
--- a/features.d/virtio.modules
+++ b/features.d/virtio.modules
@@ -1,2 +1,3 @@
 kernel/drivers/block/virtio*
 kernel/drivers/virtio
+kernel/drivers/net/virtio_net*
--- a/initramfs-init.in
+++ b/initramfs-init.in
@@ -445,9 +445,7 @@
 	eend $? $errstr || ovlfiles=
 	# hack, incase /root/.ssh was included in apkovl
 	[ -d "$sysroot/root" ] && chmod 700 "$sysroot/root"
-	pkgs="$pkgs $(sed 's/\#.*//' $sysroot/etc/lbu/packages.list 2>/dev/null)"
-	pkgs="$pkgs $(cat $sysroot/var/lib/apk/world \
-		$sysroot/etc/apk/world 2>/dev/null)"
+	pkgs="$pkgs $(cat $sysroot/etc/apk/world 2>/dev/null)"
 fi
 
 if [ -f "$sysroot/etc/.default_boot_services" -o ! -f "$ovl" ]; then
@@ -558,11 +556,16 @@
 	apkflags="$apkflags --clean-protected"
 	[ -n "$ovlfiles" ] && apkflags="$apkflags --overlay-from-stdin"
 fi
+mkdir -p $sysroot/sys $sysroot/proc $sysroot/dev
+mount -o bind /sys $sysroot/sys
+mount -o bind /proc $sysroot/proc
+mount -o bind /dev $sysroot/dev
 if [ -n "$ovlfiles" ]; then
 	apk add --root $sysroot $repo_opt $apkflags $pkgs <$ovlfiles
 else
 	apk add --root $sysroot $repo_opt $apkflags $pkgs
 fi
+umount $sysroot/sys $sysroot/proc $sysroot/dev
 eend $?
 
 # unmount ovl mount if needed
--- a/mkinitfs.in
+++ b/mkinitfs.in
@@ -184,7 +184,7 @@
 shift $(( $OPTIND - 1 ))
 
 . $(readlink -f "$config")
-features_dir=${features_dir:-"$sysconfdir/features.d"}
+features_dir=${features_dir:-"${basedir%/:-}/${sysconfdir#/}/features.d"}
 [ -n "$myfeatures" ] && features="$myfeatures"
 
 if [ -n "$list_features" ]; then