Author: ks156
Date: 2009-03-11 11:51:24 +0100 (Wed, 11 Mar 2009)
New Revision: 3948
Modified:
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
Log:
* Compute the total download size and wait a confirmation before updating.
Modified:
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
2009-03-11 10:19:16 UTC (rev 3947)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
2009-03-11 10:51:24 UTC (rev 3948)
@@ -90,15 +90,32 @@
if len(toInstall) == 0:
print ""
print "No new update available"
+ proceed = False
else:
+ # Compute the total download size
+ totalSize = 0
+ for item in toInstall:
+ totalSize = totalSize + int(item['fileSize'])
+ # Ask if the user will proceed the update
+ print ""
+ print "New update available"
+ print "Total downloading size : %.2f Mb"% \
+ float(float(totalSize) / (1048576.0))
+ answer = raw_input("Proceed ? [Y/N] : ")
+ if answer.startswith("Y") or answer.startswith("y"):
+ proceed = True
+ else:
+ print "The update process has been aborted"
+ proceed = False
+
+ if proceed:
# Kill the services
for service in processToKillList:
os.system("pkill -f %s"%service)
# Install or update the new software
for item in toInstall:
- print item['name']
# Copy the new files
if item['command'] == "COPY":
dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
@@ -120,22 +137,20 @@
cd /tmp/tuxdroid_upd/%s && /bin/bash install.sh %s &&\
rm -rf /tmp/tuxdroid_upd/" \
%(filename, filename.split("-")[0], dest))
-
+ writeDb(data)
# Uninstall the ununsed stuff
- for item in toRemove:
- dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
- if item['command'] == "COPY":
- if os.path.isfile(dest):
- os.system("rm %s"%dest)
- elif item['command'] == "INST":
- if os.path.isdir(dest):
- print item
- os.system("cd %s && /bin/bash uninstall.sh"%dest)
+ for item in toRemove:
+ dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
+ if item['command'] == "COPY":
+ if os.path.isfile(dest):
+ os.system("rm %s"%dest)
+ elif item['command'] == "INST":
if os.path.isdir(dest):
- RMDirs(dest)
+ os.system("cd %s && /bin/bash uninstall.sh"%dest)
+ if os.path.isdir(dest):
+ RMDirs(dest)
- writeDb(data)
if __name__ == "__main__":
main()
------------------------------------------------------------------------------
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