Exemple #1
0
        private string GetFullPathForExecutable(string name)
        {
            foreach (string test in (EnvironmentInfo.GetEnvironmentVariable("PATH") ?? "").Split(EnvironmentInfo.PathSeparator))
            {
                string path = test.Trim();

                if (!String.IsNullOrEmpty(path) && FileSystem.FileExists(path = Path.Combine(path, name)))
                {
                    return(FileSystem.GetFullPath(path));
                }
            }

            return(String.Empty);
        }
Exemple #2
0
        public LinuxIsoManager(ILogger logger, IFileSystem fileSystem, IEnvironmentInfo environment, IProcessFactory processFactory, IMediaEncoder mediaEncoder)
        {
            EnvironmentInfo   = environment;
            FileSystem        = fileSystem;
            Logger            = logger;
            ProcessFactory    = processFactory;
            this.mediaEncoder = mediaEncoder;

            MountPointRoot = FileSystem.DirectorySeparatorChar + "tmp" + FileSystem.DirectorySeparatorChar + "Emby";

            Logger.Debug(
                "[{0}] System PATH is currently set to [{1}].",
                Name,
                EnvironmentInfo.GetEnvironmentVariable("PATH") ?? ""
                );

            Logger.Debug(
                "[{0}] System path separator is [{1}].",
                Name,
                EnvironmentInfo.PathSeparator
                );

            Logger.Debug(
                "[{0}] Mount point root is [{1}].",
                Name,
                MountPointRoot
                );

            //
            // Get the location of the executables we need to support mounting/unmounting ISO images.
            //

            SudoCommand = GetFullPathForExecutable("sudo");

            Logger.Info(
                "[{0}] Using version of [sudo] located at [{1}].",
                Name,
                SudoCommand
                );

            MountCommand = GetFullPathForExecutable("mount");

            Logger.Info(
                "[{0}] Using version of [mount] located at [{1}].",
                Name,
                MountCommand
                );

            UmountCommand = GetFullPathForExecutable("umount");

            Logger.Info(
                "[{0}] Using version of [umount] located at [{1}].",
                Name,
                UmountCommand
                );

            if (!String.IsNullOrEmpty(SudoCommand) && !String.IsNullOrEmpty(MountCommand) && !String.IsNullOrEmpty(UmountCommand))
            {
                ExecutablesAvailable = true;
            }
            else
            {
                ExecutablesAvailable = false;
            }
        }