Author: ks156
Date: 2009-03-12 10:39:58 +0100 (Thu, 12 Mar 2009)
New Revision: 3976
Added:
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/firmware_installer.sh
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/generic_install.sh
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/sound_installer.sh
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/misc/
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
Removed:
software_suite_v2/tuxware/installers/unix/branches/refactoring/firmware_installer.sh
software_suite_v2/tuxware/installers/unix/branches/refactoring/generic_install.sh
software_suite_v2/tuxware/installers/unix/branches/refactoring/misc/
software_suite_v2/tuxware/installers/unix/branches/refactoring/sound_installer.sh
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
Log:
* Reorganized the project.
* Set 755 mod for the files during the installation
Deleted:
software_suite_v2/tuxware/installers/unix/branches/refactoring/firmware_installer.sh
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/firmware_installer.sh
2009-03-12 09:36:58 UTC (rev 3975)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/firmware_installer.sh
2009-03-12 09:39:58 UTC (rev 3976)
@@ -1,79 +0,0 @@
-#!/bin/bash
-#===============================================================================
-#
-# FILE: install.sh
-#
-# USAGE: ./install.sh
-#
-# DESCRIPTION:
-#
-# OPTIONS: ---
-# REQUIREMENTS: ---
-# BUGS: ---
-# NOTES: ---
-# AUTHOR: Paul Rathgeb (), [email protected]
-# COMPANY:
-# VERSION: 1.0
-# CREATED: 03/09/2009 11:12:41 AM CET
-# REVISION: ---
-#===============================================================================
-mkdir $1
-echo "#!/bin/bash" >> $1/install.sh
-echo '[ -d $1 ] && [[ -d $1/uninstall ]] && /bin/bash $1/uninstall.sh $1' >>
$1/install.sh
-echo '[ -d $1 ] || mkdir -p $1' >> $1/install.sh
-cmd="cp -r $1/* "' $1'
-echo "$cmd" >> $1/install.sh
-echo 'cp tuxup $2/bin/tuxup' >> $1/install.sh
-echo 'chmod +x $2/bin/tuxup' >> $1/install.sh
-echo 'cp dfu-programmer $2/bin/dfu-programmer' >> $1/install.sh
-echo 'chmod +x $2/bin/dfu-programmer' >> $1/install.sh
-REPO=http://svn.tuxisalive.com/firmware/hex/tags/0.9.1
-svn export -q $REPO $1/$1
-cd $1/$1
-echo "#!/bin/bash" > uninstall.sh
-echo "" >> uninstall.sh
-echo '# Remove previously installed files' >> uninstall.sh
-for file in `find . -type f`; do
- echo 'rm $1/'"$file" >> uninstall.sh
-done
-echo "" >> uninstall.sh
-echo "# Find python compiled files " >> uninstall.sh
-echo 'for file in `find $1 -iname "*.pyc"`; do' >> uninstall.sh
-echo ' rm $1/$file' >> uninstall.sh
-echo 'done' >> uninstall.sh
-echo "" >> uninstall.sh
-echo '# Check for empty dirs' >> uninstall.sh
-echo 'find $1 -type d > flist' >> uninstall.sh
-echo 'tac flist |' >> uninstall.sh
-echo 'while read line; do' >> uninstall.sh
-echo ' if [ ! "$(ls -A $line)" ]; then' >> uninstall.sh
-echo ' rm -r $line' >> uninstall.sh
-echo ' fi' >> uninstall.sh
-echo 'done' >> uninstall.sh
-echo 'rm flist' >> uninstall.sh
-echo "" >> uninstall.sh
-echo "# Remove the root directory if it's empty" >> uninstall.sh
-cd - >/dev/null
-rev=`svn info $REPO |grep "Last Changed Rev"`
-rev=${rev##* }
-# Pack dfu-programmer
-wget \
-http://kent.dl.sourceforge.net/sourceforge/dfu-programmer/dfu-programmer-0.5.1.tar.gz
-O /tmp/dfu.tar.gz
-tar -xvf /tmp/dfu.tar.gz -C /tmp/
-cd /tmp/dfu*
-./configure; make
-pwd=`pwd`
-cd -
-cp $pwd/src/dfu-programmer $1
-rm -rf /tmp/dfu*
-
-svn export -q \
-http://svn.tuxisalive.com/firmware/tuxup/unix/trunk tuxup
-cd tuxup
-make
-cp tuxup ../$1
-cd -
-rm -r tuxup
-tar -czf $1.tar.gz $1
-mv $1.tar.gz $1-$rev.tar.gz
-rm -r $1
Deleted:
software_suite_v2/tuxware/installers/unix/branches/refactoring/generic_install.sh
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/generic_install.sh
2009-03-12 09:36:58 UTC (rev 3975)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/generic_install.sh
2009-03-12 09:39:58 UTC (rev 3976)
@@ -1,55 +0,0 @@
-#!/bin/bash
-#===============================================================================
-#
-# FILE: install.sh
-#
-# USAGE: ./install.sh
-#
-# DESCRIPTION:
-#
-# OPTIONS: ---
-# REQUIREMENTS: ---
-# BUGS: ---
-# NOTES: ---
-# AUTHOR: Paul Rathgeb (), [email protected]
-# COMPANY:
-# VERSION: 1.0
-# CREATED: 03/09/2009 11:12:41 AM CET
-# REVISION: ---
-#===============================================================================
-mkdir $2
-echo "#!/bin/bash" >> $2/install.sh
-echo '[ -d $1 ] && [[ -d $1/uninstall ]] && /bin/bash $1/uninstall.sh $1' >>
$2/install.sh
-echo '[ -d $1 ] || mkdir -p $1' >> $2/install.sh
-cmd="cp -r $2/* "' $1'
-echo "$cmd" >> $2/install.sh
-svn export -q $1 $2/$2
-cd $2/$2
-echo "#!/bin/bash" > uninstall.sh
-echo "" >> uninstall.sh
-echo '# Remove previously installed files' >> uninstall.sh
-for file in `find . -type f`; do
- echo 'rm $1/'"$file" >> uninstall.sh
-done
-echo "" >> uninstall.sh
-echo "# Find python compiled files " >> uninstall.sh
-echo 'for file in `find $1 -iname "*.pyc"`; do' >> uninstall.sh
-echo ' rm $1/$file' >> uninstall.sh
-echo 'done' >> uninstall.sh
-echo "" >> uninstall.sh
-echo '# Check for empty dirs' >> uninstall.sh
-echo 'find $1 -type d > flist' >> uninstall.sh
-echo 'tac flist |' >> uninstall.sh
-echo 'while read line; do' >> uninstall.sh
-echo ' if [ ! "$(ls -A $line)" ]; then' >> uninstall.sh
-echo ' rm -r $line' >> uninstall.sh
-echo ' fi' >> uninstall.sh
-echo 'done' >> uninstall.sh
-echo 'rm flist' >> uninstall.sh
-echo "" >> uninstall.sh
-echo "# Remove the root directory if it's empty" >> uninstall.sh
-cd - >/dev/null
-rev=`svn info $1 |grep "Last Changed Rev"`
-rev=${rev##* }
-tar -czf $2-$rev.tar.gz $2
-rm -r $2
Copied:
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/firmware_installer.sh
(from rev 3970,
software_suite_v2/tuxware/installers/unix/branches/refactoring/firmware_installer.sh)
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/firmware_installer.sh
(rev 0)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/firmware_installer.sh
2009-03-12 09:39:58 UTC (rev 3976)
@@ -0,0 +1,79 @@
+#!/bin/bash
+#===============================================================================
+#
+# FILE: install.sh
+#
+# USAGE: ./install.sh
+#
+# DESCRIPTION:
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Paul Rathgeb (), [email protected]
+# COMPANY:
+# VERSION: 1.0
+# CREATED: 03/09/2009 11:12:41 AM CET
+# REVISION: ---
+#===============================================================================
+mkdir $1
+echo "#!/bin/bash" >> $1/install.sh
+echo '[ -d $1 ] && [[ -d $1/uninstall ]] && /bin/bash $1/uninstall.sh $1' >>
$1/install.sh
+echo '[ -d $1 ] || mkdir -p $1' >> $1/install.sh
+cmd="cp -r $1/* "' $1'
+echo "$cmd" >> $1/install.sh
+echo 'cp tuxup $2/bin/tuxup' >> $1/install.sh
+echo 'chmod +x $2/bin/tuxup' >> $1/install.sh
+echo 'cp dfu-programmer $2/bin/dfu-programmer' >> $1/install.sh
+echo 'chmod +x $2/bin/dfu-programmer' >> $1/install.sh
+REPO=http://svn.tuxisalive.com/firmware/hex/tags/0.9.1
+svn export -q $REPO $1/$1
+cd $1/$1
+echo "#!/bin/bash" > uninstall.sh
+echo "" >> uninstall.sh
+echo '# Remove previously installed files' >> uninstall.sh
+for file in `find . -type f`; do
+ echo 'rm $1/'"$file" >> uninstall.sh
+done
+echo "" >> uninstall.sh
+echo "# Find python compiled files " >> uninstall.sh
+echo 'for file in `find $1 -iname "*.pyc"`; do' >> uninstall.sh
+echo ' rm $1/$file' >> uninstall.sh
+echo 'done' >> uninstall.sh
+echo "" >> uninstall.sh
+echo '# Check for empty dirs' >> uninstall.sh
+echo 'find $1 -type d > flist' >> uninstall.sh
+echo 'tac flist |' >> uninstall.sh
+echo 'while read line; do' >> uninstall.sh
+echo ' if [ ! "$(ls -A $line)" ]; then' >> uninstall.sh
+echo ' rm -r $line' >> uninstall.sh
+echo ' fi' >> uninstall.sh
+echo 'done' >> uninstall.sh
+echo 'rm flist' >> uninstall.sh
+echo "" >> uninstall.sh
+echo "# Remove the root directory if it's empty" >> uninstall.sh
+cd - >/dev/null
+rev=`svn info $REPO |grep "Last Changed Rev"`
+rev=${rev##* }
+# Pack dfu-programmer
+wget \
+http://kent.dl.sourceforge.net/sourceforge/dfu-programmer/dfu-programmer-0.5.1.tar.gz
-O /tmp/dfu.tar.gz
+tar -xvf /tmp/dfu.tar.gz -C /tmp/
+cd /tmp/dfu*
+./configure; make
+pwd=`pwd`
+cd -
+cp $pwd/src/dfu-programmer $1
+rm -rf /tmp/dfu*
+
+svn export -q \
+http://svn.tuxisalive.com/firmware/tuxup/unix/trunk tuxup
+cd tuxup
+make
+cp tuxup ../$1
+cd -
+rm -r tuxup
+tar -czf $1.tar.gz $1
+mv $1.tar.gz $1-$rev.tar.gz
+rm -r $1
Copied:
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/generic_install.sh
(from rev 3970,
software_suite_v2/tuxware/installers/unix/branches/refactoring/generic_install.sh)
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/generic_install.sh
(rev 0)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/generic_install.sh
2009-03-12 09:39:58 UTC (rev 3976)
@@ -0,0 +1,55 @@
+#!/bin/bash
+#===============================================================================
+#
+# FILE: install.sh
+#
+# USAGE: ./install.sh
+#
+# DESCRIPTION:
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Paul Rathgeb (), [email protected]
+# COMPANY:
+# VERSION: 1.0
+# CREATED: 03/09/2009 11:12:41 AM CET
+# REVISION: ---
+#===============================================================================
+mkdir $2
+echo "#!/bin/bash" >> $2/install.sh
+echo '[ -d $1 ] && [[ -d $1/uninstall ]] && /bin/bash $1/uninstall.sh $1' >>
$2/install.sh
+echo '[ -d $1 ] || mkdir -p $1' >> $2/install.sh
+cmd="cp -r $2/* "' $1'
+echo "$cmd" >> $2/install.sh
+svn export -q $1 $2/$2
+cd $2/$2
+echo "#!/bin/bash" > uninstall.sh
+echo "" >> uninstall.sh
+echo '# Remove previously installed files' >> uninstall.sh
+for file in `find . -type f`; do
+ echo 'rm $1/'"$file" >> uninstall.sh
+done
+echo "" >> uninstall.sh
+echo "# Find python compiled files " >> uninstall.sh
+echo 'for file in `find $1 -iname "*.pyc"`; do' >> uninstall.sh
+echo ' rm $1/$file' >> uninstall.sh
+echo 'done' >> uninstall.sh
+echo "" >> uninstall.sh
+echo '# Check for empty dirs' >> uninstall.sh
+echo 'find $1 -type d > flist' >> uninstall.sh
+echo 'tac flist |' >> uninstall.sh
+echo 'while read line; do' >> uninstall.sh
+echo ' if [ ! "$(ls -A $line)" ]; then' >> uninstall.sh
+echo ' rm -r $line' >> uninstall.sh
+echo ' fi' >> uninstall.sh
+echo 'done' >> uninstall.sh
+echo 'rm flist' >> uninstall.sh
+echo "" >> uninstall.sh
+echo "# Remove the root directory if it's empty" >> uninstall.sh
+cd - >/dev/null
+rev=`svn info $1 |grep "Last Changed Rev"`
+rev=${rev##* }
+tar -czf $2-$rev.tar.gz $2
+rm -r $2
Copied:
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/sound_installer.sh
(from rev 3975,
software_suite_v2/tuxware/installers/unix/branches/refactoring/sound_installer.sh)
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/sound_installer.sh
(rev 0)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/installers/sound_installer.sh
2009-03-12 09:39:58 UTC (rev 3976)
@@ -0,0 +1,53 @@
+#!/bin/bash
+#===============================================================================
+#
+# FILE: install.sh
+#
+# USAGE: ./install.sh
+#
+# DESCRIPTION:
+#
+# OPTIONS: ---
+# REQUIREMENTS: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Paul Rathgeb (), [email protected]
+# COMPANY:
+# VERSION: 1.0
+# CREATED: 03/09/2009 11:12:41 AM CET
+# REVISION: ---
+#===============================================================================
+mkdir $1
+echo "#!/bin/bash" >> $1/install.sh
+echo '[ -d $1 ] && [[ -d $1/uninstall ]] && /bin/bash $1/uninstall.sh $1' >>
$1/install.sh
+echo '[ -d $1 ] || mkdir -p $1' >> $1/install.sh
+cmd="cp -r $1/* "' $1'
+echo "$cmd" >> $1/install.sh
+REPO=http://svn.tuxisalive.com/software_suite_v1/software/tuxgi/trunk/sounds/
+svn export -q $REPO $1/$1
+cd $1/$1
+chmod +x *
+echo "#!/bin/bash" > uninstall.sh
+echo "" >> uninstall.sh
+echo '# Remove previously installed files' >> uninstall.sh
+for file in `find . -type f`; do
+ echo 'rm $1/'"$file" >> uninstall.sh
+done
+echo "" >> uninstall.sh
+echo '# Check for empty dirs' >> uninstall.sh
+echo 'find $1 -type d > flist' >> uninstall.sh
+echo 'tac flist |' >> uninstall.sh
+echo 'while read line; do' >> uninstall.sh
+echo ' if [ ! "$(ls -A $line)" ]; then' >> uninstall.sh
+echo ' rm -r $line' >> uninstall.sh
+echo ' fi' >> uninstall.sh
+echo 'done' >> uninstall.sh
+echo 'rm flist' >> uninstall.sh
+echo "" >> uninstall.sh
+echo "# Remove the root directory if it's empty" >> uninstall.sh
+cd - >/dev/null
+rev=`svn info $REPO |grep "Last Changed Rev"`
+rev=${rev##* }
+tar -czf $1.tar.gz $1
+mv $1.tar.gz $1-$rev.tar.gz
+rm -r $1
Copied:
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/misc
(from rev 3970,
software_suite_v2/tuxware/installers/unix/branches/refactoring/misc)
Copied:
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
(from rev 3970,
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py)
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
(rev 0)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/software_updater/tux_software_updater.py
2009-03-12 09:39:58 UTC (rev 3976)
@@ -0,0 +1,197 @@
+#!/usr/bin/python
+
+from misc.suRulesTool import *
+from misc.installedFileDB import *
+from misc.tuxPaths import *
+from misc.URLTools import *
+from misc.DirectoriesAndFilesTools import *
+from misc.progressBar import progressBar
+import getopt
+import sys
+import os
+
+DEBUG = 0
+
+def __usage():
+ """__usage()
+ Give the help to know how to use tux_software_updater
+ """
+ print "-"*80
+ print "Tux Software Updater"
+ print "-"*80
+ print " This sofware is used to update the local installation of Tux Droid"
+ print ""
+ print "Usage :"
+ print " -h | --help :"
+ print " Display this help and exit"
+ print " -d | --debug :"
+ print " Set the debug mode. This option will display more informations"
+ print " during the update process."
+ print " -v VERSION | --verion=VERSION"
+ print " Set the version to update. Possible versions :"
+ print " - 'Online' : Stable versions"
+ print " - 'QC' : Beta versions"
+ print " - 'Work' : Alpha version (unstable)"
+ print " If this option isn't specified, the default version will be"
+ print " Online"
+ print ""
+ print "-"*80
+ print ""
+ sys.exit(0)
+
+def __retrieveRules(data):
+ """__retrieveRules :
+ This function check if the database exists, and create two lists :
+ - toInstall : list containing all the stuff to install
+ - toRemove : list containing the stuff to remove
+
+ @param data : an array containing the server rules
+ #return: toInstall, toRemove
+ """
+
+ # Retrieve the DB file
+ if isInstalledDb():
+ toInstall, toRemove = parseDb(data)
+ else:
+ toInstall = data
+ toRemove = []
+ return toInstall, toRemove
+
+def __isSomethingToUpdate(toInstall):
+ """__isSomethingToUpdate
+ Check if a new file has to be updated.
+ @param toInstall A list containing the rules of the software to install
+ @return True if something has to be updated
+ """
+ # Check if new updates are available
+ proceed = False
+ 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
+ return proceed
+
+def __updateSystem(data, toInstall, toRemove, processToKillList):
+ """__updateSystem
+ This function install, update or remove the applications from the server.
+ It also kill the process specified before updating the system.
+ @param data : The complete list retrieved from the server
+ @param toInstall : A list containing the files to install
+ @param toRemove : A list containing the files to uninstall
+ @param processToKillList : The list of the process to kill before uptdating
+ """
+ # Kill the services
+ for service in processToKillList:
+ os.system("pkill -f %s"%service)
+
+ pb = progressBar()
+ pb.init(len(toInstall), 'Download', '%')
+ # Install or update the new software
+ for item in toInstall:
+ pb.incProgressBar()
+ # Copy the new files
+ if item['command'] == "COPY":
+ dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
+ 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
+ elif item['command'] == "INST":
+ os.system("mkdir -p /tmp/tuxdroid_upd")
+ dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
+ path = os.path.split(dest)[0]
+ filename = os.path.split(item['source'])[1]
+
+ 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 &&\
+ rm -rf /tmp/tuxdroid_upd/" \
+ %(filename, filename.split("-")[0], dest, TUXDROID_PREFIX))
+ print ''
+ 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):
+ os.system("cd %s && /bin/bash uninstall.sh"%dest)
+ if os.path.isdir(dest):
+ RMDirs(dest)
+
+def main():
+ global DEBUG
+
+ # Set the default version type
+ VERSION="Online"
+
+ # Set the options parameters
+ try:
+ opts, args = getopt.getopt(sys.argv[1:], "dhv:",\
+ ["debug", "help", "version="])
+ except getopt.error, msg:
+ print msg
+ print "For help use --help"
+ sys.exit(2)
+
+ # Parse the given options
+ for o,a in opts:
+ if o in ("-d", "--debug"):
+ DEBUG=1
+ if o in ("-h", "--help"):
+ __usage()
+ if o in ("-v", "--version"):
+ if a == "QC" or a == "Online" or a == "Work":
+ VERSION=a
+ else:
+ print "Unrecognized version type : %s"%a
+ print "Please see the help for the version type"
+ sys.exit(2)
+
+ # Retrieve informations from the server
+ print ""
+ print "Retrieving informations from the server."
+ print "This operation can take a while ..."
+ success, data, processToKillList, processToRelaunchList = \
+ getSoftwaresDataFromServer(VERSION)
+
+ # Control the errors
+ if success != RES_NO_ERROR:
+ print ""
+ print "Error !"
+ print "The server seems to be under maintenance. Please retry later."
+ if DEBUG:
+ print "(%d) : %s" % (success, data)
+
+ toInstall, toRemove = __retrieveRules(data)
+
+ if __isSomethingToUpdate(toInstall):
+ __updateSystem(data, toInstall, toRemove, processToKillList)
+
+
+if __name__ == "__main__":
+ main()
Deleted:
software_suite_v2/tuxware/installers/unix/branches/refactoring/sound_installer.sh
===================================================================
---
software_suite_v2/tuxware/installers/unix/branches/refactoring/sound_installer.sh
2009-03-12 09:36:58 UTC (rev 3975)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/sound_installer.sh
2009-03-12 09:39:58 UTC (rev 3976)
@@ -1,53 +0,0 @@
-#!/bin/bash
-#===============================================================================
-#
-# FILE: install.sh
-#
-# USAGE: ./install.sh
-#
-# DESCRIPTION:
-#
-# OPTIONS: ---
-# REQUIREMENTS: ---
-# BUGS: ---
-# NOTES: ---
-# AUTHOR: Paul Rathgeb (), [email protected]
-# COMPANY:
-# VERSION: 1.0
-# CREATED: 03/09/2009 11:12:41 AM CET
-# REVISION: ---
-#===============================================================================
-mkdir $1
-echo "#!/bin/bash" >> $1/install.sh
-echo '[ -d $1 ] && [[ -d $1/uninstall ]] && /bin/bash $1/uninstall.sh $1' >>
$1/install.sh
-echo '[ -d $1 ] || mkdir -p $1' >> $1/install.sh
-cmd="cp -r $1/* "' $1'
-echo "$cmd" >> $1/install.sh
-REPO=http://svn.tuxisalive.com/software_suite_v1/software/tuxgi/trunk/sounds/
-svn export -q $REPO $1/$1
-cd $1/$1
-chmod +x *
-echo "#!/bin/bash" > uninstall.sh
-echo "" >> uninstall.sh
-echo '# Remove previously installed files' >> uninstall.sh
-for file in `find . -type f`; do
- echo 'rm $1/'"$file" >> uninstall.sh
-done
-echo "" >> uninstall.sh
-echo '# Check for empty dirs' >> uninstall.sh
-echo 'find $1 -type d > flist' >> uninstall.sh
-echo 'tac flist |' >> uninstall.sh
-echo 'while read line; do' >> uninstall.sh
-echo ' if [ ! "$(ls -A $line)" ]; then' >> uninstall.sh
-echo ' rm -r $line' >> uninstall.sh
-echo ' fi' >> uninstall.sh
-echo 'done' >> uninstall.sh
-echo 'rm flist' >> uninstall.sh
-echo "" >> uninstall.sh
-echo "# Remove the root directory if it's empty" >> uninstall.sh
-cd - >/dev/null
-rev=`svn info $REPO |grep "Last Changed Rev"`
-rev=${rev##* }
-tar -czf $1.tar.gz $1
-mv $1.tar.gz $1-$rev.tar.gz
-rm -r $1
Deleted:
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-12 09:36:58 UTC (rev 3975)
+++
software_suite_v2/tuxware/installers/unix/branches/refactoring/tux_software_updater.py
2009-03-12 09:39:58 UTC (rev 3976)
@@ -1,196 +0,0 @@
-#!/usr/bin/python
-
-from misc.suRulesTool import *
-from misc.installedFileDB import *
-from misc.tuxPaths import *
-from misc.URLTools import *
-from misc.DirectoriesAndFilesTools import *
-from misc.progressBar import progressBar
-import getopt
-import sys
-import os
-
-DEBUG = 0
-
-def __usage():
- """__usage()
- Give the help to know how to use tux_software_updater
- """
- print "-"*80
- print "Tux Software Updater"
- print "-"*80
- print " This sofware is used to update the local installation of Tux Droid"
- print ""
- print "Usage :"
- print " -h | --help :"
- print " Display this help and exit"
- print " -d | --debug :"
- print " Set the debug mode. This option will display more informations"
- print " during the update process."
- print " -v VERSION | --verion=VERSION"
- print " Set the version to update. Possible versions :"
- print " - 'Online' : Stable versions"
- print " - 'QC' : Beta versions"
- print " - 'Work' : Alpha version (unstable)"
- print " If this option isn't specified, the default version will be"
- print " Online"
- print ""
- print "-"*80
- print ""
- sys.exit(0)
-
-def __retrieveRules(data):
- """__retrieveRules :
- This function check if the database exists, and create two lists :
- - toInstall : list containing all the stuff to install
- - toRemove : list containing the stuff to remove
-
- @param data : an array containing the server rules
- #return: toInstall, toRemove
- """
-
- # Retrieve the DB file
- if isInstalledDb():
- toInstall, toRemove = parseDb(data)
- else:
- toInstall = data
- toRemove = []
- return toInstall, toRemove
-
-def __isSomethingToUpdate(toInstall):
- """__isSomethingToUpdate
- Check if a new file has to be updated.
- @param toInstall A list containing the rules of the software to install
- @return True if something has to be updated
- """
- # Check if new updates are available
- proceed = False
- 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
- return proceed
-
-def __updateSystem(data, toInstall, toRemove, processToKillList):
- """__updateSystem
- This function install, update or remove the applications from the server.
- It also kill the process specified before updating the system.
- @param data : The complete list retrieved from the server
- @param toInstall : A list containing the files to install
- @param toRemove : A list containing the files to uninstall
- @param processToKillList : The list of the process to kill before uptdating
- """
- # Kill the services
- for service in processToKillList:
- os.system("pkill -f %s"%service)
-
- pb = progressBar()
- pb.init(len(toInstall), 'Download', '%')
- # Install or update the new software
- for item in toInstall:
- pb.incProgressBar()
- # Copy the new files
- if item['command'] == "COPY":
- dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
- path, filename = os.path.split(dest)
- if not os.path.isdir(path):
- os.system("mkdir -p %s"%path)
-
- URLDownloadToFile(item['source'], dest)
- # Install a meta-package
- elif item['command'] == "INST":
- os.system("mkdir -p /tmp/tuxdroid_upd")
- dest = item['destination'].replace("$PREFIX", TUXDROID_PREFIX)
- path = os.path.split(dest)[0]
- filename = os.path.split(item['source'])[1]
-
- 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 &&\
- rm -rf /tmp/tuxdroid_upd/" \
- %(filename, filename.split("-")[0], dest, TUXDROID_PREFIX))
- print ''
- 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):
- os.system("cd %s && /bin/bash uninstall.sh"%dest)
- if os.path.isdir(dest):
- RMDirs(dest)
-
-def main():
- global DEBUG
-
- # Set the default version type
- VERSION="Online"
-
- # Set the options parameters
- try:
- opts, args = getopt.getopt(sys.argv[1:], "dhv:",\
- ["debug", "help", "version="])
- except getopt.error, msg:
- print msg
- print "For help use --help"
- sys.exit(2)
-
- # Parse the given options
- for o,a in opts:
- if o in ("-d", "--debug"):
- DEBUG=1
- if o in ("-h", "--help"):
- __usage()
- if o in ("-v", "--version"):
- if a == "QC" or a == "Online" or a == "Work":
- VERSION=a
- else:
- print "Unrecognized version type : %s"%a
- print "Please see the help for the version type"
- sys.exit(2)
-
- # Retrieve informations from the server
- print ""
- print "Retrieving informations from the server."
- print "This operation can take a while ..."
- success, data, processToKillList, processToRelaunchList = \
- getSoftwaresDataFromServer(VERSION)
-
- # Control the errors
- if success != RES_NO_ERROR:
- print ""
- print "Error !"
- print "The server seems to be under maintenance. Please retry later."
- if DEBUG:
- print "(%d) : %s" % (success, data)
-
- toInstall, toRemove = __retrieveRules(data)
-
- if __isSomethingToUpdate(toInstall):
- __updateSystem(data, toInstall, toRemove, processToKillList)
-
-
-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