Example #1
0
    def PostInstall(self):
        try:
            tar = tarfile.open(self.tmp + self.TrayFile, "r:gz")
            tar.extractall(self.install + 'bin')
            tar.close()
        except:
            subutai.RaiseError("Failed to unpack Tray archive. Aborting")
            return 86

        self.__writeDesktopFile()
        postinst = subuco.PostInstall(self.tmp)
        postinst.append('mkdir -p /opt/subutai/bin')
        postinst.append('mkdir -p /opt/subutai/etc')
        postinst.append('mkdir -p /opt/subutai/resources')
        postinst.append('chown -R ' + os.environ['USER'] + ':' +
                        os.environ['USER'] + ' /opt/subutai')
        postinst.append('ln -s ' + self.install +
                        'bin/SubutaiTray /usr/local/bin/SubutaiTray')
        postinst.append('desktop-file-install ' + self.tmp +
                        'SubutaiTray.desktop')
        try:
            p = Popen([
                '/usr/bin/gksudo', '--message', 'Finalize Tray Installation',
                postinst.get()
            ],
                      stdin=PIPE,
                      stdout=PIPE,
                      stderr=PIPE,
                      universal_newlines=True)
            stdout, stderr = p.communicate('')
        except:
            subutai.RaiseError("Failed to launch Subutai Tray application")

        return 0
Example #2
0
 def PostInstall(self):
     self.__writeConfiguration()
     postinst = subuco.PostInstall(self.tmp)
     postinst.append('systemctl stop ' + self.Daemon)
     postinst.append('systemctl disable ' + self.Daemon)
     postinst.append('mkdir -p /opt/subutai/bin')
     postinst.append('mkdir -p /opt/subutai/etc')
     postinst.append('mkdir -p /opt/subutai/resources')
     postinst.append('cp ' + self.tmp + self.RemoteP2PFile + ' ' +
                     self.install + "bin/" + self.P2PFile)
     postinst.append('chown -R ' + os.environ['USER'] + ':' +
                     os.environ['USER'] + ' /opt/subutai')
     postinst.append('chmod +x ' + self.install + "bin/" + self.P2PFile)
     postinst.append('cp ' + self.tmp + self.Daemon +
                     ' /etc/systemd/system/' + self.Daemon)
     postinst.append('chmod +x /etc/systemd/system/' + self.Daemon)
     postinst.append('systemctl enable ' + self.Daemon)
     postinst.append('systemctl start ' + self.Daemon)
     p = Popen([
         '/usr/bin/gksudo', '--message', 'Finalize P2P Installation',
         postinst.get()
     ],
               stdin=PIPE,
               stdout=PIPE,
               stderr=PIPE,
               universal_newlines=True)
     stdout, stderr = p.communicate('')
     return 0
Example #3
0
 def PostInstall(self):
     self.__writeConfiguration()
     postinst = subuco.PostInstall(self.tmp)
     postinst.append('if [ -e /Library/LaunchDaemons/'+self.Daemon+' ]; then')
     postinst.append('launchctl unload /Library/LaunchDaemons/'+self.Daemon)
     postinst.append('fi')
     postinst.append('cp '+self.tmp+self.Daemon+' /Library/LaunchDaemons/'+self.Daemon)
     postinst.append('cp '+self.tmp+self.LogConf+' /etc/newsyslog.d/'+self.LogConf)
     postinst.append('launchctl load /Library/LaunchDaemons/'+self.Daemon)
     postinst.append('installer -pkg '+self.tmp+self.TapFile+' -target /')
     postinst.append('if [ -e /usr/local/bin/p2p ]; then')
     postinst.append('rm -f /usr/local/bin/p2p')
     postinst.append('fi')
     postinst.append('ln -s '+self.install+'bin/p2p /usr/local/bin/p2p')
     ins = 'do shell script "/bin/sh '+postinst.get()+'" with administrator privileges'
     p = Popen(['osascript', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
     stdout, stderr = p.communicate(ins)
     if p.returncode != 0:
         return 91
     return 0
Example #4
0
 def PostInstall(self):
     subutai.SetAction('POSTINST')
     pfile = 'ffddnlbamkjlbngpekmdpnoccckapcnh.json'
     location = os.environ['HOME'] + '/Library/Application Support/Google/Chrome/External Extensions'
     slocation = os.environ['HOME'] + '/Library/Application\ Support/Google/Chrome/External\ Extensions/'
     script = 'tell application "Google Chrome" to quit'
     p = Popen(['osascript', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
     stdout, stderr = p.communicate(script)
     postinst = subuco.PostInstall(self.tmp)
     postinst.append('if [ ! -d "'+location+'" ]; then')
     postinst.append('mkdir -p ' + slocation)
     postinst.append('fi')
     postinst.append('rm -f '+slocation+pfile)
     postinst.append('cp '+self.tmp+pfile+' '+slocation+pfile)
     postinst.append('chown -R '+os.environ['USER']+' '+os.environ['HOME']+'/Library/Application\ Support/Google' )
     ins = 'do shell script "/bin/sh '+postinst.get()+'" with administrator privileges'
     p = Popen(['osascript', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
     stdout, stderr = p.communicate(ins)
     if p.returncode != 0:
         return 95
     return 0
Example #5
0
def InstallVirtualBox(tmp, install, progress):
    subutai.AddStatus("Downloading VirtualBox")
    subutai.download(GetVirtualBoxName())
    while subutai.isDownloadComplete() != 1:
        sleep(0.05)
        progress.setVboxProgress(subutai.GetBytesDownload())
        progress.updateProgress()

    progress.setVboxProgress(progress.getVboxSize())
    progress.updateProgress()
    try:
        subutai.AddStatus("Installing VirtualBox")
        postinst = subuco.PostInstall(tmp)
        postinst.append('dpkg -i ' + tmp + GetVirtualBoxName())
        postinst.append('modprobe vboxdrv >> /tmp/subutai/vbox.log 2>&1')
        postinst.append('modprobe vboxnetflt >> /tmp/subutai/vbox.log 2>&1')
        postinst.append('modprobe vboxnetadp >> /tmp/subutai/vbox.log 2>&1')
        postinst.append('modprobe vboxpci >> /tmp/subutai/vbox.log 2>&1')
        postinst.append("apt-get install -f -y")
        postinst.append('cat /tmp/subutai/vbox.log')
        p = run([
            '/usr/bin/gksudo', '--message', 'Install VirtualBox',
            postinst.get()
        ],
                stdout=PIPE,
                stderr=PIPE,
                encoding="utf-8")
        if p.stdout != '':
            subutai.Information(p.stdout)
        if p.stderr != '':
            subutai.Error(p.stderr)
    except:
        subutai.RaiseError("Failed to install VirtualBox. Aborting")
        return 45
    if not CheckVirtualBox():
        subutai.RaiseError("Failed to install VirtualBox. Aborting")
        return 24

    return 0
Example #6
0
    def PostInstall(self):
        try:
            tar = tarfile.open(self.tmp+self.TrayFile, "r:gz")
            tar.extractall("/Applications/Subutai")
            tar.close()
        except:
            subutai.RaiseError("Failed to unpack Tray archive. Aborting")
            return 86
        postinst = subuco.PostInstall(self.tmp)
        postinst.append('installer -pkg '+self.tmp+self.LibsshFile+' -target /')
        ins = 'do shell script "/bin/sh '+postinst.get()+'" with administrator privileges'
        p = Popen(['osascript', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
        stdout, stderr = p.communicate(ins)
        if p.returncode != 0:
            return 91

        try:
            launch = 'tell application "SubutaiTray.app" to activate'
            p = Popen(['osascript', '-'], stdin=PIPE, stdout=PIPE, stderr=PIPE, universal_newlines=True)
            stdout, stderr = p.communicate(launch)
        except:
            subutai.RaiseError("Failed to launch Subutai Tray application")

        return 0
Example #7
0
 def PostInstall(self):
     self.__writeJson()
     subutai.SetAction("POSINST")
     location = '/opt/google/chrome/extensions/'
     postinst = subuco.PostInstall(self.tmp)
     postinst.append('dpkg -i ' + self.tmp + self.GoogleChromeFile)
     postinst.append('apt-get install -f -y')
     if not os.path.exists(location):
         postinst.append('mkdir -p ' + location)
     postinst.append('cp ' + self.tmp + self.Plugin + ' ' + location)
     try:
         p = Popen([
             '/usr/bin/gksudo', '--message', 'Finalize E2E Installation',
             postinst.get()
         ],
                   stdin=PIPE,
                   stdout=PIPE,
                   stderr=PIPE,
                   universal_newlines=True)
         stdout, stderr = p.communicate('')
     except:
         subutai.RaiseError("Failed to install Google Chrome")
         return 64
     return 0