2013-09-22 20:46:25 +02:00
|
|
|
from common.tasks import workspace
|
|
|
|
from common.tasks import packages
|
|
|
|
from common.tasks import host
|
2013-12-30 12:14:43 +01:00
|
|
|
from common.tasks import boot
|
2013-10-09 00:09:34 +02:00
|
|
|
from common.tasks import bootstrap
|
2013-09-22 20:46:25 +02:00
|
|
|
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,
|
2014-02-23 22:03:13 +01:00
|
|
|
bootstrap.AddRequiredCommands,
|
2014-02-23 21:51:28 +01:00
|
|
|
host.CheckExternalCommands,
|
2013-10-09 00:09:34 +02:00
|
|
|
bootstrap.Bootstrap,
|
2013-09-22 20:46:25 +02:00
|
|
|
workspace.DeleteWorkspace,
|
|
|
|
]
|
|
|
|
|
|
|
|
volume_set = [volume.Attach,
|
|
|
|
volume.Detach,
|
2014-02-23 22:03:13 +01:00
|
|
|
filesystem.AddRequiredCommands,
|
2013-10-09 00:09:34 +02:00
|
|
|
filesystem.Format,
|
|
|
|
filesystem.FStab,
|
2013-09-22 20:46:25 +02:00
|
|
|
]
|
|
|
|
|
2014-02-23 22:03:13 +01:00
|
|
|
partitioning_set = [partitioning.AddRequiredCommands,
|
|
|
|
partitioning.PartitionVolume,
|
2013-09-22 20:46:25 +02:00
|
|
|
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,
|
|
|
|
]
|
|
|
|
|
2014-01-09 17:21:29 +01:00
|
|
|
|
|
|
|
def get_apt_set(manifest):
|
|
|
|
base = [apt.AddDefaultSources,
|
|
|
|
apt.WriteSources,
|
|
|
|
apt.DisableDaemonAutostart,
|
|
|
|
apt.AptUpdate,
|
|
|
|
apt.AptUpgrade,
|
2014-01-12 12:46:59 +01:00
|
|
|
packages.InstallPackages,
|
2014-01-09 17:21:29 +01:00
|
|
|
apt.PurgeUnusedPackages,
|
|
|
|
apt.AptClean,
|
|
|
|
apt.EnableDaemonAutostart,
|
|
|
|
]
|
|
|
|
if 'sources' in manifest.packages:
|
|
|
|
base.append(apt.AddManifestSources)
|
2014-01-12 12:46:59 +01:00
|
|
|
if 'trusted-keys' in manifest.packages:
|
|
|
|
base.append(apt.InstallTrustedKeys)
|
|
|
|
if 'install' in manifest.packages:
|
|
|
|
base.append(packages.AddManifestPackages)
|
2014-04-01 13:31:07 -03:00
|
|
|
if manifest.packages.get('install_standard', False):
|
|
|
|
base.append(packages.AddTaskselStandardPackages)
|
2014-01-09 17:21:29 +01:00
|
|
|
return base
|
|
|
|
|
2013-09-22 20:46:25 +02:00
|
|
|
|
2013-12-29 16:09:47 +01:00
|
|
|
locale_set = [locale.LocaleBootstrapPackage,
|
|
|
|
locale.GenerateLocale,
|
2013-09-22 20:46:25 +02:00
|
|
|
locale.SetTimezone,
|
|
|
|
]
|
|
|
|
|
2013-10-06 01:42:32 +02:00
|
|
|
|
2014-03-31 14:16:16 +02:00
|
|
|
bootloader_set = {'grub': [boot.AddGrubPackage, boot.ConfigureGrub, boot.InstallGrub],
|
2013-12-30 12:14:43 +01:00
|
|
|
'extlinux': [boot.AddExtlinuxPackage, boot.InstallExtLinux],
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2013-10-06 01:42:32 +02:00
|
|
|
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
|