Esempio n. 1
0
    def update(self):
        self.logger.info("Attempting update from source.")

        self.UPDATING = 1
        cherrypy.engine.exit()

        tarUrl = 'https://github.com/%s/%s/tarball/%s' % (gitUser, gitRepo, gitBranch)

        # Download tar
        downloaded = self.__downloadTar(tarUrl, self.updateFile)
        if (downloaded is False):
            return False

        # Extract to temp folder
        extracted = self.__extractUpdate(self.updateFile, self.updateDir)
        if (extracted is False):
            return False

        # Overwite app source with source from extracted file
        overwritten = self.__updateSourcecode()
        if (overwritten is False):
            return False

        # Write new version to file
        self.__updateVersionFile(self.latestHash)

        # Restart HTPC Manager to make sure all new code is loaded
        self.logger.warning('Restarting HTPC Manager after update.')
        do_restart()

        # Cleanup after yourself
        self.__finishUpdate()
Esempio n. 2
0
    def update(self):
        self.logger.info("Attempting update from source.")

        self.UPDATING = 1

        tarUrl = 'https://github.com/%s/%s/tarball/%s' % (gitUser, gitRepo, htpc.settings.get('branch', 'master2'))

        # Download tar
        downloaded = self.__downloadTar(tarUrl, self.updateFile)
        if downloaded is False:
            return False

        # Extract to temp folder
        extracted = self.__extractUpdate(self.updateFile, self.updateDir)
        if extracted is False:
            return False

        # Overwite app source with source from extracted file
        overwritten = self.__updateSourcecode()
        if overwritten is False:
            return False

        # Write new version to file
        # Just call it directly in case forced update.
        self.__updateVersionFile(self.latest())

        # Cleanup after yourself
        self.__finishUpdate()

        # Restart HTPC Manager to make sure all new code is loaded
        self.logger.warning('Restarting HTPC Manager after update.')
        htpc.settings.set('app_updated_at', str(time.time()))
        do_restart()
Esempio n. 3
0
    def update(self):
        """ Do update through git """
        self.logger.info("Attempting update through Git.")
        self.UPDATING = 1

        if htpc.settings.get('branch', 'master2') == self.current_branch_name():
            output = self.git_exec(self.git, 'pull origin %s' % htpc.settings.get('branch', 'master2'))
        else:
            output = self.git_exec(self.git, 'checkout -f ' + htpc.settings.get('branch', 'master2'))
        if not output:
            self.logger.error("Unable to update through git. Make sure that Git is located in your path and can be accessed by this application.")
        elif 'Aborting.' in output:
            self.logger.error("Update aborted.")
        else:
            if htpc.settings.get('git_cleanup') and not htpc.DEV:
                self.logger.debug("Clean up after git")
                self.git_exec(self.git, 'reset --hard')
                # Note to self: rtfm before you run git commands, just wiped the data dir...
                # This command removes all untracked files and files and the files in .gitignore
                # except from the content of htpc.DATADIR and VERSION.txt
                self.git_exec(self.git, 'clean -d -fx -e %s -e VERSION.txt -e userdata/' % htpc.DATADIR)
            self.logger.warning('Restarting HTPC Manager after update.')
            htpc.settings.set('app_updated_at', str(time.time()))
            # Restart HTPC Manager to make sure all new code is loaded
            do_restart()

        self.UPDATING = 0
Esempio n. 4
0
    def update(self):
        self.logger.info("Attempting update from source.")

        self.UPDATING = 1

        tarUrl = 'https://github.com/%s/%s/tarball/%s' % (
            gitUser, gitRepo, htpc.settings.get('branch', 'master2'))

        # Download tar
        downloaded = self.__downloadTar(tarUrl, self.updateFile)
        if downloaded is False:
            return False

        # Extract to temp folder
        extracted = self.__extractUpdate(self.updateFile, self.updateDir)
        if extracted is False:
            return False

        # Overwite app source with source from extracted file
        overwritten = self.__updateSourcecode()
        if overwritten is False:
            return False

        # Write new version to file
        # Just call it directly in case forced update.
        self.__updateVersionFile(self.latest())

        # Cleanup after yourself
        self.__finishUpdate()

        # Restart HTPC Manager to make sure all new code is loaded
        self.logger.warning('Restarting HTPC Manager after update.')
        htpc.settings.set('app_updated_at', str(time.time()))
        do_restart()
Esempio n. 5
0
    def update(self):
        """ Do update through git """
        self.logger.info("Attempting update through Git.")
        self.UPDATING = 1

        output = self.git_exec('pull origin %s' % gitBranch)
        if not output:
            self.logger.error("Unable to update through git. Make sure that Git is located in your path and can be accessed by this application.")
        elif 'Aborting.' in output:
            self.logger.error("Update aborted.")
        else:
            # Restart HTPC Manager to make sure all new code is loaded
            self.logger.warning('Restarting HTPC Manager after update.')
            do_restart()

        self.UPDATING = 0
Esempio n. 6
0
    def update(self):
        """ Do update through git """
        self.logger.info("Attempting update through Git.")
        self.UPDATING = 1

        if htpc.settings.get('branch',
                             'master2') == self.current_branch_name():
            output = self.git_exec(
                self.git,
                'pull origin %s' % htpc.settings.get('branch', 'master2'))
        else:
            output = self.git_exec(
                self.git,
                'checkout -f ' + htpc.settings.get('branch', 'master2'))
        if not output:
            self.logger.error(
                "Unable to update through git. Make sure that Git is located in your path and can be accessed by this application."
            )
        elif 'Aborting.' in output:
            self.logger.error("Update aborted.")
        else:
            if htpc.settings.get('git_cleanup') and not htpc.DEV:
                self.logger.debug("Clean up after git")
                self.git_exec(self.git, 'reset --hard')
                # Note to self: rtfm before you run git commands, just wiped the data dir...
                # This command removes all untracked files and files and the files in .gitignore
                # except from the content of htpc.DATADIR and VERSION.txt
                self.git_exec(
                    self.git,
                    'clean -d -fx -e %s -e VERSION.txt -e userdata/' %
                    htpc.DATADIR)
            self.logger.warning('Restarting HTPC Manager after update.')
            htpc.settings.set('app_updated_at', str(time.time()))
            # Restart HTPC Manager to make sure all new code is loaded
            do_restart()

        self.UPDATING = 0