Exemplo n.º 1
0
        public static void WorkingDirectories()
        {
            if (MountHelper.IsAlreadyMounted("/mnt/cdrom/Kernel/active-firmware", "/lib64/firmware") == false)
            {
                MountSimple("/mnt/cdrom/Kernel/active-firmware", "/lib64/firmware");
            }
            var kernelRelease = Bash.Execute("uname -r").Trim();
            var linkedRelease = Bash.Execute("file /mnt/cdrom/Kernel/active-modules").Trim();

            if (MountHelper.IsAlreadyMounted("/mnt/cdrom/Kernel/active-modules") == false &&
                linkedRelease.Contains(kernelRelease))
            {
                var moduleDir = $"/lib64/modules/{kernelRelease}/";
                Directory.CreateDirectory(moduleDir);
                MountSimple("/mnt/cdrom/Kernel/active-modules", moduleDir);
            }
            Bash.Execute("systemctl restart systemd-modules-load.service", false);
            foreach (var dir in DefaultWorkingDirectories)
            {
                var mntDir = MountHelper.ConvertDirectoryTargetPathToDirs(dir);
                Directory.CreateDirectory(dir);
                Directory.CreateDirectory(mntDir);
                if (MountHelper.IsAlreadyMounted(dir))
                {
                    continue;
                }
                ConsoleLogger.Log($"[mount] {mntDir} -> {dir}");
                MountWithBind(mntDir, dir);
            }
            foreach (var kvp in DefaultWorkingDirectoriesWithOptions)
            {
                if (MountHelper.IsAlreadyMounted(kvp.Key) == false)
                {
                    MountSimple(kvp.Value, kvp.Key);
                }
            }
        }