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

Re: /etc/network/interfaces and snapshot persistence



Le 13/10/2011 15:40, Daniel Baumann a écrit :
On 10/13/2011 03:26 PM, Axel wrote:
If no ip is defined in boot arguments, use the configuration file from
live media/persistency. If the file is empty, fall back to dhcp.
sounds good.


Patch against the current git "upstream" branch. For live-build 2.*, the workaround is to add "ip=frommedia" to the bootappend-live option of lb config.

Axel
diff --git a/scripts/live b/scripts/live
index 5fb8a26..d6e9a7e 100755
--- a/scripts/live
+++ b/scripts/live
@@ -151,12 +151,6 @@ Arguments ()
 
 			ip=*)
 				STATICIP="${ARGUMENT#ip=}"
-
-				if [ -z "${STATICIP}" ]
-				then
-					STATICIP="frommedia"
-				fi
-
 				export STATICIP
 				;;
 
diff --git a/scripts/live-bottom/23networking b/scripts/live-bottom/23networking
index 86d4562..619d719 100755
--- a/scripts/live-bottom/23networking
+++ b/scripts/live-bottom/23networking
@@ -33,7 +33,12 @@ log_begin_msg "Preconfiguring networking"
 
 IFFILE="/root/etc/network/interfaces"
 
-if [ "${STATICIP}" = "frommedia" -a -e  "${IFFILE}" ]
+if [ -z "${STATICIP}" ]
+then
+	STATICIP="frommedia"
+fi
+
+if [ "${STATICIP}" = "frommedia" -a -e  "${IFFILE}" -a -n "$(grep -Ev '^#' ${IFFILE})" ]
 then
 	# will use existent /etc/network/interfaces
 	log_end_msg

Reply to: