Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images #121

Merged
merged 2 commits into from Oct 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion model/model.go
Expand Up @@ -59,6 +59,7 @@ type SystemInstall struct {
PostInstall []*InstallHook `yaml:"post-install,omitempty,flow"`
Version uint `yaml:"version,omitempty,flow"`
StorageAlias []*StorageAlias `yaml:"block-devices,omitempty,flow"`
LegacyBios bool `yaml:"legacyBios,omitempty,flow"`
}

// InstallHook is a commands to be executed in a given point of the install process
Expand Down Expand Up @@ -177,7 +178,7 @@ func (si *SystemInstall) Validate() error {
}

for _, curr := range si.TargetMedias {
if err := curr.Validate(); err != nil {
if err := curr.Validate(si.LegacyBios); err != nil {
return err
}
}
Expand Down
27 changes: 27 additions & 0 deletions scripts/aws-disable-root.sh
@@ -0,0 +1,27 @@
#!/bin/bash

# Root login must bedisabled aws images

usage() {
echo "usage: $0 [chrootpath]"
echo "Provide path to existing chroot"
exit 1
}


main() {
local CHROOTPATH=$1
sudo mkdir -p ${CHROOTPATH}/etc/ssh/
sudo echo "PermitRootLogin no" >> ${CHROOTPATH}/etc/ssh/sshd_config

}

if [ $# -eq 0 ]; then
usage
fi

if [ ! -d "$1" ]; then
usage
fi

main $@
39 changes: 39 additions & 0 deletions scripts/aws.yaml
@@ -0,0 +1,39 @@
#clear-linux-config

# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "aws", file: "aws.img"}
]

targetMedia:
- name: ${aws}
size: "512M"
type: disk
children:
- name: ${aws}1
fstype: ext4
mountpoint: /
options: -b 4096 -O ^64bit
size: "512M"
type: part

bundles: [
openssh-server,
os-cloudguest-aws,
os-core,
os-core-update,
]

postArchive: false
postReboot: false
telemetry: false
legacyBios: true

keyboard: us
language: en_US.UTF-8
kernel: kernel-aws

post-install: [
{cmd: "scripts/aws-disable-root.sh ${chrootDir}"}
]
40 changes: 40 additions & 0 deletions scripts/azure-docker.yaml
@@ -0,0 +1,40 @@
#clear-linux-config

# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "azure-docker", file: "azure-docker.img"}
]

targetMedia:
- name: ${azure-docker}
size: "20G"
type: disk
children:
- name: ${azure-docker}1
fstype: ext4
mountpoint: /
options: -O ^64bit
size: "20G"
type: part

bundles: [
cloud-native-basic,
editors,
network-basic,
openssh-server,
os-cloudguest-azure,
os-core,
os-core-update,
storage-utils,
sysadmin-basic,
]

postArchive: false
postReboot: false
telemetry: false
legacyBios: true

keyboard: us
language: en_US.UTF-8
kernel: kernel-hyperv
40 changes: 40 additions & 0 deletions scripts/azure-machine-learning.yaml
@@ -0,0 +1,40 @@
#clear-linux-config

# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "bdevice", file: "azure-machine-learning.img"}
]

targetMedia:
- name: ${bdevice}
size: "20G"
type: disk
children:
- name: ${bdevice}1
fstype: ext4
mountpoint: /
options: -O ^64bit
size: "20G"
type: part

bundles: [
editors,
machine-learning-basic,
network-basic,
openssh-server,
os-cloudguest-azure,
os-core,
os-core-update,
storage-utils,
sysadmin-basic,
]

postArchive: false
postReboot: false
telemetry: false
legacyBios: true

keyboard: us
language: en_US.UTF-8
kernel: kernel-hyperv
39 changes: 39 additions & 0 deletions scripts/azure.yaml
@@ -0,0 +1,39 @@
#clear-linux-config

# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "azure", file: "azure.img"}
]

targetMedia:
- name: ${azure}
size: "20G"
type: disk
children:
- name: ${azure}1
fstype: ext4
mountpoint: /
options: -O ^64bit
size: "20G"
type: part

bundles: [
editors,
network-basic,
openssh-server,
os-cloudguest-azure,
os-core,
os-core-update,
storage-utils,
sysadmin-basic,
]

postArchive: false
postReboot: false
telemetry: false
legacyBios: true

keyboard: us
language: en_US.UTF-8
kernel: kernel-hyperv
40 changes: 40 additions & 0 deletions scripts/ciao-networking.yaml
@@ -0,0 +1,40 @@
#clear-linux-config

# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "bdevice", file: "cloud.img"}
]

targetMedia:
- name: ${bdevice}
size: "864M"
type: disk
children:
- name: ${bdevice}1
fstype: vfat
mountpoint: /boot
size: "64M"
type: part
- name: ${bdevice}2
fstype: ext4
mountpoint: /
size: "800M"
type: part

bundles: [
os-core,
os-core-update,
os-cloudguest,
openssh-server,
bootloader,
]

autoUpdate: false
postArchive: false
postReboot: false
telemetry: false

keyboard: us
language: en_US.UTF-8
kernel: kernel-kvm
41 changes: 41 additions & 0 deletions scripts/cloud-docker.yaml
@@ -0,0 +1,41 @@
#clear-linux-config

# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "bdevice", file: "cloud-docker.img"}
]

targetMedia:
- name: ${bdevice}
size: "2.07G"
type: disk
children:
- name: ${bdevice}1
fstype: vfat
mountpoint: /boot
size: "64M"
type: part
- name: ${bdevice}2
fstype: ext4
mountpoint: /
size: "2G"
type: part

bundles: [
bootloader,
containers-basic,
openssh-server,
os-cloudguest,
os-core,
os-core-update,
]

autoUpdate: false
postArchive: false
postReboot: false
telemetry: false

keyboard: us
language: en_US.UTF-8
kernel: kernel-kvm
40 changes: 40 additions & 0 deletions scripts/cloud.yaml
@@ -0,0 +1,40 @@
#clear-linux-config

# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "bdevice", file: "cloud.img"}
]

targetMedia:
- name: ${bdevice}
size: "864M"
type: disk
children:
- name: ${bdevice}1
fstype: vfat
mountpoint: /boot
size: "64M"
type: part
- name: ${bdevice}2
fstype: ext4
mountpoint: /
size: "800M"
type: part

bundles: [
bootloader,
cloud-network,
os-cloudguest,
os-core,
os-core-update,
]

autoUpdate: false
postArchive: false
postReboot: false
telemetry: false

keyboard: us
language: en_US.UTF-8
kernel: kernel-kvm
34 changes: 34 additions & 0 deletions scripts/containers.yaml
@@ -0,0 +1,34 @@
#clear-linux-config

# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "bdevice", file: "containers.img"}
]

targetMedia:
- name: ${bdevice}
size: "864M"
type: disk
children:
- name: ${bdevice}1
fstype: ext4
options: -b 4096
mountpoint: /
size: "224M"
type: part

bundles: [
os-core,
os-clear-containers,
]

autoUpdate: false
postArchive: false
postReboot: false
telemetry: false
legacyBios: true

keyboard: us
language: en_US.UTF-8
kernel: kernel-kvm
28 changes: 28 additions & 0 deletions scripts/gce-image-google-sudoers-setup.sh
@@ -0,0 +1,28 @@
#!/bin/bash

# This script creates the sudoers elements that
# GCE expects in the image to add user to google-sudoers
# whe a user key is injected

usage() {
echo "Provide path to existing chroot"
exit 1
}


main() {
local CHROOTPATH=$1
sudo touch ${CHROOTPATH}/etc/sudoers
sudo chmod 440 ${CHROOTPATH}/etc/sudoers
sudo mkdir ${CHROOTPATH}/etc/sudoers.d
}

if [ $# -eq 0 ]; then
usage
fi

if [ ! -d "$1" ]; then
usage
fi

main $@