Author: ks156
Date: 2009-03-12 15:56:52 +0100 (Thu, 12 Mar 2009)
New Revision: 4009

Modified:
   
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
Log:
* Added an installation mode :
  tux_software_updater -i MIRROR_PATH -p PREFIX
  This will create a mirror from the software_updater.


Modified: 
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
===================================================================
--- 
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
     2009-03-12 14:29:20 UTC (rev 4008)
+++ 
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
     2009-03-12 14:56:52 UTC (rev 4009)
@@ -12,6 +12,8 @@
 
 ARCH = None
 PREFIX = None
+INSTALL = ""
+CREATE_DB = False
 DEBUG = 0
 
 def __usage():
@@ -52,7 +54,7 @@
     """
 
     # Retrieve the DB file
-    if isInstalledDb():
+    if isInstalledDb() and not CREATE_DB:
         toInstall, toRemove = parseDb(data, ARCH)
     else:
         toInstall = data
@@ -111,10 +113,10 @@
         # Copy the new files
         if item['command'] == "COPY":
             dest = item['destination'].replace("$PREFIX", PREFIX)
+            dest = INSTALL + dest
             path, filename = os.path.split(dest)
             if not os.path.isdir(path):
                 os.system("mkdir -p %s"%path)
-            
             URLDownloadToFile(item['source'], dest)
             os.system("chmod 755 %s"%dest)
         # Install a meta-package
@@ -127,9 +129,10 @@
             URLDownloadToFile(item['source'], "/tmp/tuxdroid_upd/%s"%filename)
             
             os.system("tar -xf /tmp/tuxdroid_upd/%s -C /tmp/tuxdroid_upd/ &&\
-                    cd /tmp/tuxdroid_upd/%s && /bin/bash install.sh %s %s &&\
+                    cd /tmp/tuxdroid_upd/%s && /bin/bash install.sh %s%s %s &&\
                     rm -rf /tmp/tuxdroid_upd/" \
-                    %(filename, filename.split("-")[0], dest, PREFIX))
+                    %(filename, filename.split("-")[0], INSTALL, dest, INSTALL\
+                    + "/" + PREFIX))
     print ''
     writeDb(data)
 
@@ -180,6 +183,7 @@
 def main():
     global DEBUG
     global PREFIX 
+    global INSTALL
     PREFIX = TUXDROID_PREFIX
     
     # Set the default version type
@@ -188,8 +192,8 @@
     
     # Set the options parameters
     try:
-        opts, args = getopt.getopt(sys.argv[1:], "dhv:p:",\
-                ["debug", "help", "version=", "prefix="])
+        opts, args = getopt.getopt(sys.argv[1:], "dhv:p:i:",\
+                ["debug", "help", "version=", "prefix=", "install"])
     except getopt.error, msg:
         print msg
         print "For help use --help"
@@ -210,7 +214,14 @@
                 sys.exit(2)
         if o in ("-p", "--prefix"):
             PREFIX=a
-            print PREFIX
+        if o in ("-i", "--install"):
+            global ARCH
+            global CREATE_DB
+            INSTALL=a
+            print "Package creation mode"
+            print "Creating mirror to : %s"%INSTALL
+            ARCH = raw_input("Enter arch (x86 or x86_64) : ")
+            CREATE_DB = True
 
     # Retrieve informations from the server
     print ""


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to