strip /dev/ from labsync_disk parameter; fix hard-coded /dev/sda; remove ansible base role
This commit is contained in:
parent
e9b692fc3c
commit
f4e39467bd
9 changed files with 16 additions and 25 deletions
2
Makefile
2
Makefile
|
|
@ -130,7 +130,7 @@ qemu: qemu-network $(qemu_disk) docker-services
|
|||
-kernel "images/$(qemu_kernel)" \
|
||||
-initrd "images/$(qemu_initramfs)" \
|
||||
-drive format=raw,file="$(qemu_disk)" \
|
||||
-append "boot=labsync labsync_disk=/dev/sda labsync_partsize_boot=512 labsync_torrent=http://10.2.2.1/$(qemu_torrent) quiet vga=792 ip=$(qemu_vm_ip):::255.255.255.0:$(qemu_hostname):ens3:off labsync_wait=pause" \
|
||||
-append "boot=labsync labsync_disk=sda labsync_partsize_boot=512 labsync_torrent=http://10.2.2.1/$(qemu_torrent) quiet vga=792 ip=$(qemu_vm_ip):::255.255.255.0:$(qemu_hostname):ens3:off labsync_wait=pause" \
|
||||
-enable-kvm \
|
||||
-m 1G \
|
||||
-net nic \
|
||||
|
|
|
|||
|
|
@ -8,9 +8,6 @@
|
|||
- role: auth
|
||||
tags:
|
||||
- auth
|
||||
- role: base
|
||||
tags:
|
||||
- base
|
||||
- role: packages
|
||||
tags:
|
||||
- packages
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
- name: configure fstab
|
||||
template:
|
||||
src: fstab.j2
|
||||
dest: /etc/fstab
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
---
|
||||
- import_tasks: filesystem.yml
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
# device mountpoint type options dump pass
|
||||
/dev/sda1 / ext4 defaults 0 0
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
#!/bin/sh
|
||||
boot_partition='/dev/sda1'
|
||||
boot_partition="/dev/${LABSYNC_DISK}1"
|
||||
localboot="$(sed -n 's/^.*labsync_localboot=\([^ ]*\).*$/\1/p' /proc/cmdline)"
|
||||
|
||||
if [ -z "$localboot" ]; then
|
||||
umount "$boot_partition" || true
|
||||
echo "$boot_partition /boot ext2 defaults 0 0" > /etc/fstab
|
||||
if ! grep -q ' /boot ' /etc/fstab; then
|
||||
echo "$boot_partition /boot ext2 defaults 0 0" >> /etc/fstab
|
||||
fi
|
||||
mke2fs -t ext2 -F "$boot_partition"
|
||||
mount /boot
|
||||
rsync -av /usr/local/boot/ /boot/
|
||||
grub-install /dev/sda
|
||||
grub-install /dev/$LABSYNC_DISK
|
||||
sed -i 's/^\(GRUB_DEVICE=\).*$/\1""/' /usr/sbin/grub-mkconfig
|
||||
#sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT=\).*$/\1'"'quiet boot=labsync labsync_localboot=\"$LABSYNC\"'/" /etc/default/grub
|
||||
sed -i 's/^\(GRUB_CMDLINE_LINUX=\).*$/\1'"'boot=labsync labsync_localboot=\"$LABSYNC\"'/" /etc/default/grub
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
"echo overlay >> /etc/initramfs-tools/modules",
|
||||
"echo 'RESUME=none' > /etc/initramfs-tools/conf.d/resume",
|
||||
"mkdir /usr/local/boot",
|
||||
"apt-get -f -y install aria2 linux-image-amd64 lvm2",
|
||||
"apt-get -f -y install aria2 ca-certificates linux-image-amd64 lvm2",
|
||||
"mkdir /artifacts",
|
||||
"cp $(find /boot/ -name 'initrd.img-*' | sort -V | tail -n 1) /artifacts/initramfs",
|
||||
"cp $(find /boot/ -name 'vmlinuz-*' | sort -V | tail -n 1) /artifacts/linux"
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ labsync_mount_root() {
|
|||
lv_name_overlay="ovly-$torrent_name"
|
||||
|
||||
labsync_info "Updating partitions"
|
||||
size_disk=$(blockdev --getsz ${labsync_disk})
|
||||
size_disk=$(blockdev --getsz /dev/${labsync_disk})
|
||||
size_part_1=$((labsync_partsize_boot * 1024 * 1024 / 512))
|
||||
size_part_2=$(((size_disk - labsync_partsize_boot) * 1024 * 1024 / 512))
|
||||
start_part_2=$((size_part_1 + 2048))
|
||||
|
|
@ -111,22 +111,22 @@ labsync_mount_root() {
|
|||
|
||||
dmsetup ls --tree
|
||||
|
||||
sfdisk --force -q ${labsync_disk} << PARTTABLE
|
||||
sfdisk --force -q /dev/${labsync_disk} << PARTTABLE
|
||||
label: dos
|
||||
label-id: 0xdeadbeef
|
||||
device: ${labsync_disk}
|
||||
device: /dev/${labsync_disk}
|
||||
unit: sectors
|
||||
|
||||
${labsync_disk}1 : start= 2048, size= $size_part_1, type=83
|
||||
${labsync_disk}2 : start=$start_part_2, size= $size_part_2, type=8e
|
||||
/dev/${labsync_disk}1 : start= 2048, size= $size_part_1, type=83
|
||||
/dev/${labsync_disk}2 : start=$start_part_2, size= $size_part_2, type=8e
|
||||
PARTTABLE
|
||||
|
||||
while ! blockdev --rereadpt /dev/sda; do
|
||||
while ! blockdev --rereadpt /dev/${labsync_disk}; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
labsync_info "Doing lvm stuff"
|
||||
pv_device="${labsync_disk}2"
|
||||
pv_device="/dev/${labsync_disk}2"
|
||||
|
||||
lvm pvcreate -t "$pv_device"
|
||||
pvstatus=$?
|
||||
|
|
@ -187,6 +187,7 @@ PARTTABLE
|
|||
labsync_set_environment LABSYNC_TORRENT "${labsync_torrent}"
|
||||
labsync_set_environment LABSYNC_SQUASHFS_FILE "$squashfs_file"
|
||||
labsync_set_environment LABSYNC_SQUASHFS_LV "$lv_path_squashfs"
|
||||
labsync_set_environment LABSYNC_DISK "$labsync_disk"
|
||||
fi
|
||||
|
||||
case "$labsync_wait" in
|
||||
|
|
|
|||
2
txt.cfg
2
txt.cfg
|
|
@ -1,7 +1,7 @@
|
|||
label labsync
|
||||
menu label ^labsync
|
||||
kernel images/debian-stretch.linux
|
||||
append initrd=images/debian-stretch.initramfs.dev boot=labsync labsync_disk=/dev/sda labsync_partsize_boot=512 labsync_torrent=http://10.2.2.1/debian-stretch.torrent quiet vga=792 ip=10.2.2.10:::255.255.255.0:qemu-host:ens3:off labsync_wait=pause
|
||||
append initrd=images/debian-stretch.initramfs.dev boot=labsync labsync_disk=sda labsync_partsize_boot=512 labsync_torrent=http://10.2.2.1/debian-stretch.torrent quiet vga=792 ip=10.2.2.10:::255.255.255.0:qemu-host:ens3:off labsync_wait=pause
|
||||
|
||||
label install
|
||||
menu label ^Install
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue