Esempio n. 1
0
        private bool InstallPackage(string packageName, string packageFileName)
        {
            string errorMessage;
            bool   success;

            if (packageFileName.EndsWith(".rpm"))
            {
                success = DeployHelper.InstallRpmPackage(_device, packageFileName, out errorMessage);
            }
            else
            {
                if (_isSecureProtocol)
                {
                    // TODO!! try to remove special handling of "lldb-tv"
                    if (packageName == LldbTvPackage)
                    {
                        // TODO!! do need to uninstall?
                        string outputLine;
                        success = DeployHelperSecure.RunCommand(_device, "shell 0 vs_lldbinstall", out outputLine, out errorMessage);
                    }
                    else
                    {
                        // TODO!! do need to uninstall?
                        if (DeployHelperSecure.GetInstalledPackageVersion(_device, packageName, out errorMessage) != null)
                        {
                            DeployHelperSecure.UninstallPackage(_device, packageName, out errorMessage);
                        }
                        success = DeployHelperSecure.InstallPackage(_device, packageName, out errorMessage);
                    }
                    if (!success)
                    {
                        errorMessage = StringHelper.CombineMessages($"Cannot install package \"{packageName}\"", errorMessage);
                    }
                }
                else
                {
                    // remove old files (if any)
                    if (!SDBLib.RunSdbShellCommandAndCheckExitStatus(_device, $"rm -rf {_sdkToolPath}/{packageName}", null,
                                                                     out errorMessage))
                    {
                        DebugPrint(StringHelper.CombineMessages("Cannot remove old files", errorMessage));
                    }
                    success = DeployHelper.ExtractTarGzip(_device, packageFileName, _sdkToolPath, out errorMessage);
                }
            }
            if (success)
            {
                Print($"Successfully installed \"{packageFileName}\"");
            }
            else
            {
                Print(errorMessage);
            }
            return(success);
        }
Esempio n. 2
0
        private Version GetInstalledPackageVersion(string packageName)
        {
            Version result = null;
            Version installedVersion;

            if (_supportRpms)
            {
                GetInstalledRpmPackage(packageName, out installedVersion);
                result = installedVersion;
            }
            if (_supportTarGz)
            {
                if (_isSecureProtocol)
                {
                    string errorMessage;
                    // TODO!! try to remove special handling of "lldb-tv"
                    if (packageName == LldbTvPackage)
                    {
                        installedVersion = DeployHelperSecure.RunGetVersionCommand(_device, "shell 0 vs_lldbversion", out errorMessage);
                    }
                    else
                    {
                        installedVersion = DeployHelperSecure.GetInstalledPackageVersion(_device, packageName, out errorMessage);
                    }
                    if (!String.IsNullOrEmpty(errorMessage))
                    {
                        Print($"Check package failed for \"{packageName}\" (secure). {errorMessage}");
                    }
                }
                else
                {
                    installedVersion = GetInstalledTarGzPackageVersion(packageName);
                }
                if (installedVersion != null)
                {
                    if ((result == null) || (installedVersion > result))
                    {
                        result = installedVersion;
                    }
                }
            }
            return(result);
        }