示例#1
0
    /// <summary>
    /// Deploys a bootstrap file for importing exported feeds and implementations.
    /// </summary>
    /// <exception cref="IOException">A problem occurred while writing the script.</exception>
    /// <exception cref="UnauthorizedAccessException">Write access to the script is not permitted.</exception>
    public void DeployImportScript()
    {
        string fileName = (_architecture.OS == OS.Windows) ? "import.cmd" : "import.sh";
        string target   = Path.Combine(_destination, fileName);

        typeof(Exporter).CopyEmbeddedToFile(fileName, target);
        if (UnixUtils.IsUnix)
        {
            UnixUtils.SetExecutable(target, executable: true);
        }
    }
示例#2
0
        private void DeployBootstrap([NotNull] ITaskHandler handler, [NotNull] string mode)
        {
            string appName  = _selections.Name ?? "application";
            string fileName = (_architecture.OS == OS.Windows)
                ? mode + " " + appName + ".exe"
                : mode + "-" + appName.ToLowerInvariant().Replace(" ", "-") + ".sh";

            var source = new Uri("https://0install.de/bootstrap/" +
                                 "?platform=" + (_architecture.OS == OS.Windows ? "windows" : "linux") +
                                 "&mode=" + mode +
                                 "&name=" + HttpUtility.UrlEncode(appName) +
                                 "&uri=" + HttpUtility.UrlEncode(_selections.InterfaceUri.ToStringRfc()));
            string target = Path.Combine(_destination, fileName);

            handler.RunTask(new DownloadFile(source, target));
            if (UnixUtils.IsUnix)
            {
                UnixUtils.SetExecutable(target, executable: true);
            }
        }