libvirt_cloud/roles/toxcore/tasks/bootstrap_nbd.yml
2023-12-30 22:09:49 +00:00

84 lines
2.3 KiB
YAML

# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---
- name: "DEBUG: base bootstrap_nbd.yml nbd_out={{nbd_disk}}"
debug:
verbosity: 1
msg: "DEBUG: Including bootstrap_nbd nbd_out={{nbd_disk}}"
- block:
- name: "partition the disk"
shell: |
cat /proc/partitions | grep {{BASE_NBD_DEV}} || exit 1
cat /proc/partitions | grep {{BASE_NBD_DEV}}p1 || exit 0
[ {{BASE_NBD_DEV}}p1 = {{nbd_disk}} ]
parted -s {{nbd_disk}} mklabel msdos
parted -s {{nbd_disk}} mkpart primary 2048s 100%
partprobe
mkfs.ext4 -FF {{nbd_disk}}p1
- name: "mount the disk"
shell: |
df | grep {{nbd_disk}}p1 && exit 0
[ -d {{BASE_NBD_MP}} ] || mkdir {{BASE_NBD_MP}}
mount {{nbd_disk}}p1 {{BASE_NBD_MP}}
[ -d {{BASE_NBD_MP}}/lost+found ]
- name: "check the disk"
shell: |
df | grep {{nbd_disk}}p1 || exit 1
[ -d {{BASE_NBD_MP}}/lost+found ] || exit 2
- name: check the downloads step5
shell: |
stage3_asc=stage3-amd64-openrc-20231217T170203Z.tar.xz.sha256
stage3_xz=stage3-amd64-openrc-20231217T170203Z.tar.xz
sha256sum -c $stage3_asc
tar xJpf $stage3 --xattrs-include='*.*' --numeric-owner -C {{BASE_NBD_MP}
portage_xz=portage-20231221.tar.xz
tar xpJf $portage -C {{BASE_NBD_MP}}/usr
[ -d etc/portage/package.env ] || mkdir -p etc/portage/package.env
cat >> etc/portage/package.env/singlejob.txt << EOF
app-portage/eix singlejob.conf
dev-util/maturin singlejob.conf
dev-util/cmake singlejob.conf
[ -d etc/portage/package.license ] || mkdir -p etc/portage/package.license
EOF
chdir: "{{BASE_NBD_MP}}"
creates: "{{BASE_NBD_MP}}/etc"
- name: chroot into the partition - step4
shell: |
df | grep {{nbd_disk}}p1 || exit 1
[ -d {{BASE_NBD_MP}}/lost+found ] || exit 2
[ -d {{BASE_NBD_MP}}/proc ] && exit 0
/usr/local/sbin/base_chroot.bash {{BASE_NBD_MP}}
register: base_bootstrap_chroot_rc
- name: check the sources
shell: |
true
- name: install the downloads
shell: |
/usr/local/sbin/base_chroot_unbind.bash {{BASE_NBD_MP}}
when: base_bootstrap_chroot_rc.rc == 0
- name: stop here
shell: |
exit 1
delegate_to: localhost
when:
- nbd_disk != ''
#gpg --keyserver hkps://keys.gentoo.org --recv-keys 0xBB572E0E2D182910