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

[PATCH] support live image installing mode selection



Currently it support two modes:

 - normal: unpacks the image and do the need changes to make it look
   just as a installed system system.
 - live: unpacks the image but keep it running as live.
---
 packages/live-installer/debian/changelog           |    4 ++++
 .../live-installer/debian/live-installer.templates |   13 +++++++++++++
 packages/live-installer/debian/postinst            |   18 ++++++++++++++++++
 3 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/packages/live-installer/debian/changelog b/packages/live-installer/debian/changelog
index 7ab5706..0d7f3e1 100644
--- a/packages/live-installer/debian/changelog
+++ b/packages/live-installer/debian/changelog
@@ -12,6 +12,10 @@ live-installer (4) UNRELEASED; urgency=low
   * Clean up postinst to remove unused variables.
   * Add the required templates to provide translated progress info during
     live-installer.d hooks progress.
+  * Add support to live image installing mode selection. Currently it
+    support two modes: normal that unpacks the image and do the need
+    changes to make it look just as a installed system system; live:
+    unpacks the image but keep it running as live.
 
  -- Daniel Baumann <daniel@debian.org>  Fri, 29 Feb 2008 15:28:00 +0100
 
diff --git a/packages/live-installer/debian/live-installer.templates b/packages/live-installer/debian/live-installer.templates
index bc6c41e..45954ff 100644
--- a/packages/live-installer/debian/live-installer.templates
+++ b/packages/live-installer/debian/live-installer.templates
@@ -33,6 +33,19 @@ Type: text
 # :sl3:
 _Description: Running ${SCRIPT}...
 
+Template: live-installer/mode
+Type: select
+Default: normal
+# :sl3:
+__Choices: normal, live
+# :sl3:
+_Description: Select the installation mode:
+ Please select the installation mode to be used. This affects how the
+ resulting system will look:
+ .
+  - normal: just as a installed system;
+  - live: still run as a live system;
+
 Template: live-installer/enable
 Type: boolean
 Default: true
diff --git a/packages/live-installer/debian/postinst b/packages/live-installer/debian/postinst
index fec6cf8..f00c472 100755
--- a/packages/live-installer/debian/postinst
+++ b/packages/live-installer/debian/postinst
@@ -9,6 +9,11 @@ db_capb backup
 NEWLINE="
 "
 
+db_input low live-installer/mode || true
+db_go || exit 10 # back to menu
+db_get live-installer/mode
+mode="$RET"
+
 install_live_system () {
 	# Look at
 	PLACES=""
@@ -54,6 +59,19 @@ install_live_system () {
 		IFS=$OLD_IFS
 	done
 
+	# if we're dumping it, we need to set init=live
+	if [ "$mode" = live ]; then
+		# set the init script to use
+		if [ -d /cdrom/casper ]; then
+			db_set debian-installer/add-kernel-opts "init=casper"
+		else
+			db_set debian-installer/add-kernel-opts "init=live"
+		fi
+
+		# skip the hooks
+		return
+	fi
+
 	# run the scripts found in hook directory after copying the system
 	partsdir="/usr/lib/live-installer.d"
 	if [ -d "$partsdir" ]; then
-- 
1.5.4.3


Reply to: