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

Re: [PATCH]: New hook in base-installer



Folks,

I'm attaching a new version of patch. Can someone comment about it?

=== debian/postinst
==================================================================
--- debian/postinst   (/base-installer/trunk)   (revision 9)
+++ debian/postinst   (/base-installer/local)   (revision 9)
@@ -150,6 +150,33 @@
 		fi
 	fi
 
+	# run the scripts found in hook directory before debootstrap
+	partsdir="/usr/lib/base-installer.d"
+	db_progress INFO base-installer/progress/preparing
+
+	tmpfile=/tmp/base-installer-hook.log
+	[ -d "$partsdir"] && info "Execution hook before debootstrap"
+	for script in `ls "$partsdir"/*`; do
+	    base=$(basename $script | sed 's/[0-9]*//')
+	    if ! db_progress INFO base-installer/progress/$base; then
+		db_subst base-installer/progress/fallback SCRIPT "$base"
+		db_progress INFO base-installer/progress/fallback
+	    fi
+
+	    if [ -x "$script" ] ; then
+		info "Running $script"
+		if ! "$script" 2>&1 $tmpfile ; then
+		    log "warning: $script returned error code $?"
+		fi
+	    else
+		error "Unable to execute $script"
+	    fi
+	    if [ -s "$tmpfile" ] ; then
+		logger -t base-installer < "$tmpfile"
+		rm -f "$tmpfile"
+	    fi
+	done
+
 	if [ -e /usr/bin/cdebootstrap ]; then
 		/usr/bin/cdebootstrap || debootstrap_failed=$?
 	else
=== debian/changelog
==================================================================
--- debian/changelog   (/base-installer/trunk)   (revision 9)
+++ debian/changelog   (/base-installer/local)   (revision 9)
@@ -1,3 +1,10 @@
+base-installer (0.087) UNRELEASED; urgency=low
+
+  * Otavio Salvador
+    - Add hook to be called before debootstrap is run.
+
+ -- Otavio Salvador <otavio@debian.org>  Tue, 22 Jun 2004 16:12:07 -0300
+
 base-installer (0.086) unstable; urgency=low
 
   * Martin Michlmayr
=== debian/templates
==================================================================
--- debian/templates   (/base-installer/trunk)   (revision 9)
+++ debian/templates   (/base-installer/local)   (revision 9)
@@ -129,6 +129,14 @@
 Type: text
 _Description: Installing the Debian base system
 
+Template: base-installer/progress/preparing
+Type: text
+_Description: Preparing to install the Debian base system
+
+Template: base-installer/progress/fallback
+Type: text
+_Description: Running: ${SCRIPT}...
+
 Template: base-installer/debootstrap/section/check_target
 Type: text
 _Description: Checking the target file system
@@ -229,3 +237,4 @@
 Type: text
 #  Item in the main menu to select this package
 _Description: Install the base system
+
-- 
        O T A V I O    S A L V A D O R
---------------------------------------------
 E-mail: otavio@debian.org      UIN: 5906116
 GNU/Linux User: 239058     GPG ID: 49A5F855
 Home Page: http://www.freedom.ind.br/otavio
---------------------------------------------
"Microsoft gives you Windows ... Linux gives
 you the whole house."

Attachment: pgpB23v510rjw.pgp
Description: PGP signature


Reply to: