Author: ks156
Date: 2009-03-19 09:44:06 +0100 (Thu, 19 Mar 2009)
New Revision: 4144

Modified:
   
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/misc/URLTools.py
   
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
Log:
* Access must be granted also for downloading the files
* Access should not be granted when creating a mirror (--install)


Modified: 
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/misc/URLTools.py
===================================================================
--- 
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/misc/URLTools.py
    2009-03-19 08:42:53 UTC (rev 4143)
+++ 
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/misc/URLTools.py
    2009-03-19 08:44:06 UTC (rev 4144)
@@ -124,7 +124,7 @@
 # 
------------------------------------------------------------------------------
 # Download a file from an URL.
 # 
------------------------------------------------------------------------------
-def URLDownloadToFile(url, filePath, timeout = 5.0):
+def URLDownloadToFile(url, filePath, GRANT = "", timeout = 5.0):
     """Download a file from an URL.
     @param url: URL of the file.
     @param filePath: Output file path.
@@ -135,14 +135,16 @@
     fs = URLDownloadToString(url, timeout)
     if fs != None:
         try:
-            f = open(filePath, 'wb')
+            f = open("/tmp/dl", 'wb')
             try:
                 f.write(fs)
             except:
                 result = False
             f.close()
+            os.system("%s mv /tmp/dl %s"%(GRANT, filePath))
         except:
             result = False
     else:
         result = False
     return result
+

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-19 08:42:53 UTC (rev 4143)
+++ 
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
     2009-03-19 08:44:06 UTC (rev 4144)
@@ -22,6 +22,7 @@
 MIRROR = ""
 CREATE_DB = False
 DEBUG = 0
+INSTALL = False
 
 def __usage():
     """__usage()
@@ -163,7 +164,7 @@
                 path, filename = os.path.split(dest)
                 if not os.path.isdir(path):
                     os.system("%s mkdir -p %s"%(GRANT, path))
-                URLDownloadToFile(item['source'], dest)
+                URLDownloadToFile(item['source'], dest, GRANT)
                 os.system("%s chmod 755 %s"%(GRANT, dest))
             # Install a meta-package
             elif item['command'] == "INST":
@@ -278,8 +279,10 @@
         if o in ("-p", "--prefix"):
             PREFIX=a
         if o in ("-i", "--install"):
+            global INSTALL
             global ARCH
             global CREATE_DB
+            INSTALL = True
             MIRROR=a
             print "Package creation mode"
             print "Creating mirror to : %s"%MIRROR
@@ -306,7 +309,8 @@
     print ""
     
     if  __isSomethingToUpdate(toInstall):
-        __grantPrivilege()
+        if not INSTALL:
+            __grantPrivilege()
         __updateSystem(data, toInstall, toRemove, processToKillList, \
                 processToRelaunchList)
 


------------------------------------------------------------------------------
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