bootstrap-vz/common/task_sets.py
Anders Ingemann ebd8f71fdb Fix bug in packages stanza (fixes #126)
Created 3 new tasks:
  AddManifestSources
	AddRemoteManifestPackages
	AddLocalManifestPackages
They are added independently depending on what is specified in the manifest.
2014-01-09 17:21:29 +01:00

92 lines
2.7 KiB
Python

from common.tasks import workspace
from common.tasks import packages
from common.tasks import host
from common.tasks import boot
from common.tasks import bootstrap
from common.tasks import volume
from common.tasks import filesystem
from common.tasks import partitioning
from common.tasks import cleanup
from common.tasks import apt
from common.tasks import security
from common.tasks import locale
base_set = [workspace.CreateWorkspace,
host.HostDependencies,
host.CheckHostDependencies,
bootstrap.Bootstrap,
workspace.DeleteWorkspace,
]
volume_set = [volume.Attach,
volume.Detach,
filesystem.Format,
filesystem.FStab,
]
partitioning_set = [partitioning.PartitionVolume,
partitioning.MapPartitions,
partitioning.UnmapPartitions,
]
boot_partition_set = [filesystem.CreateBootMountDir,
filesystem.MountBoot,
]
mounting_set = [filesystem.CreateMountDir,
filesystem.MountRoot,
filesystem.MountSpecials,
filesystem.UnmountRoot,
filesystem.DeleteMountDir,
]
ssh_set = [security.DisableSSHPasswordAuthentication,
security.DisableSSHDNSLookup,
cleanup.ShredHostkeys,
]
def get_apt_set(manifest):
base = [apt.AddDefaultSources,
apt.WriteSources,
apt.DisableDaemonAutostart,
apt.AptUpdate,
apt.AptUpgrade,
packages.InstallRemotePackages,
packages.InstallLocalPackages,
apt.PurgeUnusedPackages,
apt.AptClean,
apt.EnableDaemonAutostart,
]
if 'sources' in manifest.packages:
base.append(apt.AddManifestSources)
if 'remote' in manifest.packages:
base.append(apt.AddRemoteManifestPackages)
if 'local' in manifest.packages:
base.append(apt.AddLocalManifestPackages)
return base
locale_set = [locale.LocaleBootstrapPackage,
locale.GenerateLocale,
locale.SetTimezone,
]
bootloader_set = {'grub': [boot.AddGrubPackage, boot.InstallGrub],
'extlinux': [boot.AddExtlinuxPackage, boot.InstallExtLinux],
}
def get_fs_specific_set(partitions):
task_set = {'ext2': [filesystem.TuneVolumeFS],
'ext3': [filesystem.TuneVolumeFS],
'ext4': [filesystem.TuneVolumeFS],
'xfs': [filesystem.AddXFSProgs],
}
tasks = set()
if 'boot' in partitions:
tasks.update(task_set.get(partitions['boot']['filesystem'], []))
if 'root' in partitions:
tasks.update(task_set.get(partitions['root']['filesystem'], []))
return tasks