base_role/tasks/clipos.yml
embed@git.macaw.me b50fd16591 first
2024-01-06 01:38:28 +00:00

187 lines
7.6 KiB
YAML

# -*- mode: yaml; indent-tabs-mode: nil; tab-width: 2; coding: utf-8-unix -*-
---
- name: "base clipos.yml"
debug:
verbosity: 1
msg: "DEBUG: Including base clipos.yml ansible_remote_addr={{ ansible_remote_addr|default('') }}"
- block:
# FixMe: hardcode and dups HOST_MOUNT_SYMLINKS
- name: "/mnt/src/"
shell: |
[ -e /mnt/o/net/Lfs/github.com/clipos/src/portage ] || exit 0
[ -e /mnt/src ] || mkdir /mnt/src
for elt in gentoo clipos ; do
[ -h /mnt/src/portage $elt ] && continue
[ -d /mnt/o/net/Lfs/github.com/clipos/src/portage/$elt ] || continue
ln -s /mnt/o/net/Lfs/github.com/clipos/src/portage/$elt /mnt/src/portage/$elt
done
exit 0
when:
- ansible_remote_addr|default('') == '/mnt/linuxClipos50'
- block:
- name: download CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR
shell: |
[ -z "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}" ] || { echo "ERROR: CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR if undefined" ; exit 1 ; }
[ -d "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}" ] || mkdir -p "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}"
cd "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}" || exit 3
for file in {{CHROOT_CLIPOS_DAILY_DOWNLOAD_FILES}} SHA256SUMS ; do
[ -f $file ] && continue
"{{ BASE_ARE_CONNECTED }}" == '' && continue
echo "INFO: downloading {{ CHROOT_CLIPOS_DAILY_DOWNLOAD_URL }}/$file"
wget -c {{ BASE_WGET_ARGS }} {{ CHROOT_CLIPOS_DAILY_DOWNLOAD_URL }}/$file || exit 3
done
exit 0
args:
creates: "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR|default('') }}/qemu.tar.zst"
- name: sha265 CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR
shell: |
cd "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}" || exit 3
for file in {{CHROOT_CLIPOS_DAILY_DOWNLOAD_FILES}} ; do
[ -f $file.sha256 ] && continue
sha256sum $file > $file.sha256
grep `cat $file.sha256|sed -e 's/ .*//'` SHA256SUMS || \
{ echo "ERROR: checksum failed for {{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}/$file.sha256" ; exit 4 ; }
echo "DEBUG: checksum passed for {{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}/$file.sha256"
done
for file in *.tar.zst ; do
base=`basename $file .zst`
[ -f $base ] && continue
zstdcat $file > $base >/dev/null
done
for file in *.tar ; do
[ -f $file.lis ] && continue
tar tvf $file > $file.lis >/dev/null
done
exit 0
args:
creates: "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR|default('') }}/qemu.tar.zst.sha256"
- name: core_bundle.tar
shell: |
cd "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}" || exit 3
[ ! -f out/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/efiboot/bundle/efipartition.tar ] || \
[ -f out/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/efiboot/bundle/efipartition.tar.lis ] || \
tar xfv out/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/efiboot/bundle/efipartition.tar \
> out/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/efiboot/bundle/efipartition.tar.lis
# out/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/efiboot/bundle/efipartition.tar.lis
# core_pkgs.tar
# cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/core/binpkgs/
# efiboot_bundle.tar
# out/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/efiboot/bundle/efipartition.tar
# qemu.tar.lis
# clipos_{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}_qemu/main.qcow2
exit 0
args:
chdir: "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}"
creates: "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR|default('') }}/qemu.tar.zst.sha256"
- name: core_pkgs.tar
shell: |
chroot_dir="{{ ansible_remote_addr }}"
[ -d $chroot_dir/usr/portage/packages ] || mkdir -p $chroot_dir/usr/portage/packages
tar xvkf core_pkgs.tar --strip-components=5 -C $chroot_dir/usr/portage/packages
args:
chdir: "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}"
creates: "{{ ansible_remote_addr }}/usr/portage/packages/Packages"
# Is this the live layout?
- name: sdk.tar.lis
shell: |
cd "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}" || exit 1
[ -e cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/sdk/rootfs.squashfs ] || \
tar xvf sdk.tar
[ -e cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/sdk/rootfs.squashfs.lis ] || \
unsquashfs -l -n cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/sdk/rootfs.squashfs \
> cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/sdk/rootfs.squashfs.lis
args:
creates: "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR|default('') }}/cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/sdk/rootfs.squashfs.lis"
- name: unsquash stage3
shell: |
chroot_dir="{{ ansible_remote_addr }}"
[ -d ] || { echo "ERROR: directory not found: {{ ansible_remote_addr }}" ; exit 2 ; }
file="cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/sdk/rootfs.squashfs"
[ -f "$file" ] || { echo "ERROR: file not found: $file" ; exit 3 ; }
unsquashfs -i -d $chroot_dir -n cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/sdk/rootfs.squashfs || exit 4
args:
chdir: "{{ CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR }}"
creates: "{{ ansible_remote_addr }}/etc/gentoo-release"
when: false
- name: /usr/src/linux
shell: |
chroot_dir="{{ ansible_remote_addr }}"
[ -d $chroot_dir/usr/src/linux ] || exit 0
[ -d $chroot_dir/usr/src ] || mkdir $chroot_dir/usr/src || exit 1
cp -rip {{ CHROOT_CLIPOS_LFS_DOWNLOAD_DIR }}src/external/linux/ $chroot_dir/usr/src/linux
args:
creates: "{{ ansible_remote_addr }}/usr/src/linux"
when: CHROOT_CLIPOS_LFS_DOWNLOAD_DIR|default('') != ''
- name: CHROOT_CLIPOS_PACKAGES_TBZ2
shell: |
chroot_dir="{{ ansible_remote_addr }}"
[ -d $chroot_dir/usr/src/linux ] || exit 0
[ -d /root/var/tmp/{{date_dash}} ] || mkdir -p /root/var/tmp/{{date_dash}} || exit 1
cd /root/var/tmp/{{date_dash}} || exit 2
for elt in {{ CHROOT_CLIPOS_PACKAGES_TBZ2|join(' ') }} ; do
base=`basename $elt`
if [ $base = $elt ] ; then
python{{ BASE_PYTHON3_MINOR }} `which emerge` -vb $elt >> $base.log 2>&1
else
python{{ BASE_PYTHON3_MINOR }} `which emerge` -vb $elt >> $base.log 2>&1
fi
done
exit 0
args:
creates: "{{ ansible_remote_addr }}/usr/src/linux/.config"
# "{{ ansible_remote_addr }}/boot/vmlinux"
when: "CHROOT_CLIPOS_PACKAGES_TBZ2|default([])|length > 0"
# FixMe:
# products/clipos/sdk/scripts/setup-portage.sh
delegate_to: localhost
when:
- ansible_connection|default('') == 'chroot'
- BOX_OS_FLAVOR == "Clipos50"
- "CHROOT_CLIPOS_DAILY_DOWNLOAD_DIR|default('') != ''"
# for elt in *-*; do ls /mnt/o/Cache/linuxFun64/var/cache/portage/$elt/*.* || continue; [ -d $elt ] || mkdir $elt; ln -s /mnt/o/Cache/linuxFun64/var/cache/portage/$elt/*.* $elt; echo $file; echo $elt; done
# for elt in *-*; do ls /mnt/cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/core/binpkgs/$elt/*.* || continue; [ -d $elt ] || mkdir $elt; ln -s /mnt/cache/clipos/{{CHROOT_CLIPOS_DAILY_DOWNLOAD_VER}}/core/binpkgs/$elt/*.* $elt; echo $file; echo $elt; done
- block:
# {{ CHROOT_CLIPOS_MAKE_CONFIG|join(' ') }}
- name: "was CHROOT_CLIPOS_MAKE_CONFIG - now in make-config.bash"
shell: |
# later - we have the tbz2
chroot_dir="{{ ansible_remote_addr }}"
[ -d $chroot_dir/usr/src/linux ] || exit 0
cd $chroot_dir/usr/src/linux
[ -f .config ] && mv .config .config.dst
# bogus - using /var/local/in base
{{ VAR_LOCAL }}/bin/make-config.bash -p x86_64
args:
creates: "{{ ansible_remote_addr }}/usr/src/linux/.config"
when:
- false