[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#971700: debootstrap: Please add option to get full log on stderr



Package: debootstrap
Version: 1.0.123
Tags: patch

Attached is a minimalistic patch to implement what I would need for better logging when automatically creating chroot environments. It preserves the behavior of other output options to have the I:/W:/etc. info on stdout and puts everything else on stderr.
I only did relatively limited testing, but this seems to achieve exactly what I want.
A better solution would be to _also_ log everything to debootstrap.log, I think, but I found no reasonable way to do that.

Regards,
Sven
Description: Allow stderr to be passed to the caller
 This change allows the caller of debootstrap to request that stderr is passed
 to it instead of being swallowed into debootstrap.log
Author: Sven Mueller <sven.mueller72@gmail.com>
Forwarded: no
Last-Update: 2020-10-02
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: debootstrap-1.0.123/debootstrap
===================================================================
--- debootstrap-1.0.123.orig/debootstrap
+++ debootstrap-1.0.123/debootstrap
@@ -42,6 +42,7 @@ UNPACK_TARBALL=""
 ADDITIONAL=""
 EXCLUDE=""
 VERBOSE=""
+FULL_OUTPUT=""
 CERTIFICATE=""
 CHECKCERTIF=""
 PRIVATEKEY=""
@@ -91,6 +92,8 @@ usage()
       --help                 display this help and exit
       --version              display version information and exit
       --verbose              don't turn off the output of wget
+      --full-output          show full process output on stderr, I:/W: info
+                             on stdout.
 
       --download-only        download packages, but don't perform installation
       --print-debs           print the packages to be installed, and exit
@@ -310,6 +313,11 @@ if [ $# != 0 ] ; then
 		VERBOSE=true
 		export VERBOSE
 		shift 1
+        ;;
+        --full-output)
+        FULL_OUTPUT="yes"
+        export FULL_OUTPUT
+        shift 1
 		;;
 	    --extra-suites|--extra-suites=?*)
 		if [ "$1" = "--extra-suites" ] && [ -n "$2" ]; then
@@ -618,6 +626,11 @@ elif am_doing_phase printdebs; then
 	#    stderr: I:/W:/etc information
 	#    stdout: debs needed
 	exec 4>&2
+elif [ "$FULL_OUTPUT" = yes ]; then
+	# stdout: I:/W:/etc information
+	# stderr: full log of debootstrap run (stdout/stderr combined)
+	exec 4>&1
+	exec >&2
 else
 	#    stderr: used in exceptional circumstances only
 	#    stdout: I:/W:/etc information

Reply to: