Switch to single overlay dir

Instead of tracking many directories, we'll use only one
overlay directory to hold any scripts or change we want to
see applied over the base image.

Signed-off-by: Ryan Harper <ryan.harper@canonical.com>
This commit is contained in:
Ryan Harper 2015-09-28 09:00:33 -05:00
parent 4f344714f9
commit 23d644037a
5 changed files with 52 additions and 55 deletions

View File

@ -411,7 +411,7 @@ generate_img() {
local bootloader=${3};
local offline=${4};
local extlinux_conf=${TOPDIR}/resources/menu/extlinux-menu.conf
local apparmor_path=${TOPDIR}/resources/apparmor
local overlay_path=${TOPDIR}/resources/overlay
local grub_efi_core=${TOPDIR}/resources/grub/bootx64.efi # FIXME, ARCH
local grub_conf=${TOPDIR}/resources/grub/grub.cfg
local embed_conf=${TOPDIR}/resources/grub/embed_efi.cfg
@ -583,10 +583,10 @@ generate_img() {
cat ${grub_conf} | sudo tee ${efimnt}/boot/grub/grub.cfg && true
fi
# update apparmor policy for dhclient
log "Updating apparmor policies"
sudo rsync -avP ${apparmor_path}/apparmor.d/ ${mnt}/etc/apparmor.d/ || {
log "Failed to sync local apparmor updates";
# syncing overlay
log "Injecting installer configuration/scripts"
sudo rsync -avP ${overlay_path}/ ${mnt}/ || {
log "Failed to sync local installer configuration/scripts";
return 1;
}

View File

@ -0,0 +1,39 @@
#!/bin/bash
LASTCON=$(cat /proc/cmdline | fmt -w 1 | grep ^console= | tail -n 1)
case $LASTCON in
console=ttyS[0-9])
SERIAL="-o --serial"
systemctl stop serial-getty@ttyS0.service
;;
console=tty[0-9])
SERIAL=""
chvt 1
systemctl stop getty@tty1.service;
;;
esac
# generate service file
cat <<EOF >/lib/systemd/system/subiquity.service
[Unit]
Description=Ubuntu Servier Installer Service
After=getty@tty1.service
[Service]
Environment=PYTHONPATH=/usr/local
ExecStart=-/sbin/agetty -n --noclear -l /usr/local/bin/subiquity ${SERIAL} console vt100
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
Type=idle
Restart=always
StandardInput=tty-force
StandardOutput=tty
StandardError=tty
TTYPath=/dev/console
[Install]
WantedBy=default.target
EOF
systemctl enable subiquity.service
systemctl start subiquity

View File

@ -0,0 +1,6 @@
#!/bin/bash -x
rm -f /etc/network/interfaces
echo -e "auto lo\niface lo inet loopback\n" > /etc/network/interfaces
/bin/ls -1 /sys/class/net | grep -v ^lo$ | xargs -i bash -c 'D={}; echo -e "auto $D\niface $D inet dhcp"' | tee /etc/network/interfaces
/bin/ls -1 /sys/class/net | grep -v ^lo$ | xargs -i ifup {}

View File

@ -1,61 +1,13 @@
#cloud-config
#http_proxy: http://my-proxy:3129/
bootcmd:
- rm -f /etc/network/interfaces
- echo -e "auto lo\niface lo inet loopback\n" > /etc/network/interfaces
- /bin/ls -1 /sys/class/net | grep -v ^lo$ | xargs -i bash -c 'D={}; echo -e "auto $D\niface $D inet dhcp"' | tee /etc/network/interfaces
- /bin/ls -1 /sys/class/net | grep -v ^lo$ | xargs -i ifup {}
- tee -a /etc/modprobe.d/blacklist.conf <<<"blacklist floppy"
- /subiquity/network_up.sh
password: passw0rd
chpasswd: { expire: False }
output: {all: '| tee -a /var/log/cloud-init-output.log'}
#packages
runcmd:
- tar -C /usr/local -xf /tmp/subiquity.tar
- tar -C /usr/local -xf /tmp/probert.tar
- (cd /usr/local && bin/curtin-archive extract --no-execute)
- /tmp/installer.sh
- /subiquity/installer.sh
write_files:
- content: |
#!/bin/bash
LASTCON=$(cat /proc/cmdline | fmt -w 1 | grep ^console= | tail -n 1)
case $LASTCON in
console=ttyS[0-9])
SERIAL="-o --serial"
systemctl stop serial-getty@ttyS0.service
;;
console=tty[0-9])
SERIAL=""
chvt 1
systemctl stop getty@tty1.service;
;;
esac
# generate service file
cat <<EOF >/lib/systemd/system/subiquity.service
[Unit]
Description=Ubuntu Servier Installer Service
After=getty@tty1.service
[Service]
Environment=PYTHONPATH=/usr/local
ExecStart=-/sbin/agetty -n --noclear -l /usr/local/bin/subiquity ${SERIAL} console vt100
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
Type=idle
Restart=always
StandardInput=tty-force
StandardOutput=tty
StandardError=tty
TTYPath=/dev/console
[Install]
WantedBy=default.target
EOF
systemctl enable subiquity.service
systemctl start subiquity
path: /tmp/installer.sh
owner: root:root
permissions: '0755'