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

Bug#348147: Allow subscripts to alter ROOT



Hi,

I've attached a fourth version of the ROOT-setting patch.

The only changes compared to the previous patch is that more documentation is added, both as inline comments and to the relevant man page.

I'm hoping that I can get some more feedback on whether this approach is ok, or which alternative approach that would be, soon...

Regards,
David

PS
I'll update the cryptsetup hooks and scripts in bug 358452 based on your feedback soonish.

diff -Nur initramfs-tools-0.59b.orig/initramfs-tools.8 initramfs-tools-0.59b/initramfs-tools.8
--- initramfs-tools-0.59b.orig/initramfs-tools.8	2006-03-26 11:52:26.000000000 +0200
+++ initramfs-tools-0.59b/initramfs-tools.8	2006-04-08 00:50:51.000000000 +0200
@@ -314,6 +314,13 @@
 real rootfs and execution is turned over to the init binary which should now be
 found in the mounted rootfs.
 
+.SS Changing global variables
+
+In order to allow the different subscripts to change the values of global variables
+(such as ROOT), they can write the relevant commands to /dev/.initramfs/source.me.
+The main init script will check if the file exists after each subscript execution and
+if it is found, it will be sourced and removed.
+
 .SH EXAMPLES
 
 .SS Hook script
diff -Nur initramfs-tools-0.59b.orig/scripts/functions initramfs-tools-0.59b/scripts/functions
--- initramfs-tools-0.59b.orig/scripts/functions	2006-03-26 11:59:15.000000000 +0200
+++ initramfs-tools-0.59b/scripts/functions	2006-04-08 00:43:00.000000000 +0200
@@ -161,6 +161,13 @@
 {
 	for cs_x in ${runlist}; do
 		${initdir}/${cs_x}
+		# The subscript may create a file to be sourced by the main script
+		# e.g. to change ROOT or other variables globally
+		# check if such a file exists, source it and remove it
+		if [ -e /dev/.initramfs/source.me ]; then
+			. /dev/.initramfs/source.me
+			rm -f /dev/.initramfs/source.me
+		fi
 	done
 }
 

Reply to: