SF.net SVN: morphix: [2317] trunk/morph-scripts/morphmini

[email protected] Sun, 18 Jun 2006 14:20:38 -0700
Newsgroups gmane.linux.morphix.cvs
Message-ID <[email protected]>
Revision: 2317
Author:   bmsleight
Date:     2006-06-18 14:20:33 -0700 (Sun, 18 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/morphix/?rev=2317&view=rev

Log Message:
-----------
Making /root in minimodule to be overlaid by load-minimodules.sh on to root of filesystem - see example.xml. To Do - /root/packages 

Modified Paths:
--------------
    trunk/morph-scripts/morphmini/example.xml
    trunk/morph-scripts/morphmini/morphmini
Modified: trunk/morph-scripts/morphmini/example.xml
===================================================================
--- trunk/morph-scripts/morphmini/example.xml	2006-06-18 16:19:24 UTC (rev 2316)
+++ trunk/morph-scripts/morphmini/example.xml	2006-06-18 21:20:33 UTC (rev 2317)
@@ -17,6 +17,31 @@
      <file>http://www.barwap.com/morphix/mmorphix/morphixsound2.wav</file>
     </remote>
    </filelist>
+   <root> <!-- Files or Packages to be overlaid on the rootfile system - good for saving ramspace-->
+          <!-- root currently ignores bootption and will always overlay the files -->
+    <files>
+     <local>
+      <from>/home/morph/test.jpg</from>
+      <to>/usr/share/misc/</to>
+     </local>
+     <local>
+      <from>/home/morph/test2.jpg</from>
+      <to>/usr/share/misc/</to>
+     </local>
+     <remote>
+      <from>http://www.barwap.com/morphix/mmorphix/morphixsound2.wav</from>
+      <to>/usr/share/misc/</to>
+     </remote>
+    </files>
+    <packages> <!-- Very crude way of using packages, depends is ignored, not on package list and can not be uninstalled -->
+     <local>
+      <deb>/home/morph/example.deb</deb>
+     </local>
+     <remote>
+      <deb>http://www.barwap.com/morphix/rebrand/morphix-rebrand_0.2-23_i386.deb</deb>
+     </remote>
+    </packages>
+   </root>
    <commandlist> <!-- Commands to be started from minimodule --> 
     <preX>       <!-- Commands to run before X windows start -->
      <command>echo "Hello"</command>

Modified: trunk/morph-scripts/morphmini/morphmini
===================================================================
--- trunk/morph-scripts/morphmini/morphmini	2006-06-18 16:19:24 UTC (rev 2316)
+++ trunk/morph-scripts/morphmini/morphmini	2006-06-18 21:20:33 UTC (rev 2317)
@@ -23,6 +23,7 @@
 {
 mkdir $TMP_DIR					2>/dev/null
 mkdir $TMP_DIR/minimod/				2>/dev/null
+mkdir $TMP_DIR/minimod/root				2>/dev/null
 mkdir $TMP_DIR/minimod/morphix			2>/dev/null
 mkdir $TMP_DIR/minimod/morphix/files 		2>/dev/null
 mkdir $TMP_DIR/minimod/morphix/junk 		2>/dev/null
@@ -43,6 +44,11 @@
  convert_quoted_chars
 }
 
+xml_get_tmp_pair ()
+{
+ xmlstarlet sel -t -m  "$1" -v "concat($2,'$5',$3)" -n $4 >$TMP_FILE
+ convert_quoted_chars
+}
 
 write_tags_and_desciptions ()
 {
@@ -152,6 +158,66 @@
 fi
 }
 
+process_root_files ()
+{
+#xmlstarlet sel -t -m  "//minimod/root/files/local" -v "concat('cp ',from,' ',to)" -n 
+xml_get_tmp_pair //minimod/root/files/local NULL to $TEMPLATE 
+RETURN_VALUE=$(cat $TMP_FILE)
+for ROOT_DIR in $RETURN_VALUE
+do 
+ DIR_NAME=$(dirname $ROOT_DIR\ )
+ mkdir -p $TMP_DIR/minimod/root/$DIR_NAME
+done
+xml_get_tmp_pair //minimod/root/files/local from to $TEMPLATE " $TMP_DIR/minimod/root/"
+RETURN_VALUE=$(cat $TMP_FILE)
+#http://open.itworld.com/5040/nls_unix_filedescriptor060608/page_1.html
+done=""
+exec 3< $TMP_FILE
+# read til the end of the file
+until [ $done ]
+do
+    read <&3 CP_FILES
+    if [ $? != 0 ]; then
+        done=1
+        continue
+    fi
+    if [ -n "$CP_FILES" ]; then
+        cp -a $CP_FILES
+    fi
+done
+
+xml_get_tmp_pair //minimod/root/files/remote NULL to $TEMPLATE 
+RETURN_VALUE=$(cat $TMP_FILE)
+for ROOT_DIR in $RETURN_VALUE
+do 
+ DIR_NAME=$(dirname $ROOT_DIR\ )
+ mkdir -p $TMP_DIR/minimod/root/$DIR_NAME
+done
+xml_get_tmp_pair //minimod/root/files/remote to from $TEMPLATE " "
+RETURN_VALUE=$(cat $TMP_FILE)
+#http://open.itworld.com/5040/nls_unix_filedescriptor060608/page_1.html
+done=""
+exec 3< $TMP_FILE
+# read til the end of the file
+until [ $done ]
+do
+    read <&3 CP_FILES
+    if [ $? != 0 ]; then
+        done=1
+        continue
+    fi
+    if [ -n "$CP_FILES" ]; then
+        wget --tries=3 --timeout=60 --directory-prefix=$TMP_DIR/minimod/root/$CP_FILES
+    fi
+done
+}
+
+process_root_packages ()
+{
+echo "Root Packages - Not yet done"
+}
+
+
 build_minimodule ()
 {
 module-builder $TMP_DIR/minimod/ $BMODULE
@@ -198,6 +264,8 @@
 set_up_module_build
 #Test xml file error check.
 write_tags_and_desciptions
+process_root_files
+process_root_packages
 process_bootoption
 process_filelist
 process_command_prex
@@ -205,3 +273,4 @@
 process_command_x
 build_minimodule
 remove_minimodule_tmp
+


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.