Fix USB install reliability: bash, LV resize, deps, idempotency
- autoinstall/user-data: move lvextend/growpart/pvresize BEFORE playbook so 130GB of drivers+PPKGs fits during first-boot copy. Use tr -d "[:space:]" to avoid breaking outer bash -c single-quote wrap. - playbook: add executable: /bin/bash to Dell driver deploy (process substitution) and Blancco initramfs builder (brace expansion). - playbook: make "Ensure Samba user for Blancco reports" idempotent via pdbedit check so re-runs don't abort the play. - download-packages.sh: also download dist-upgrade package set. Explicit --simulate misses transitive version bumps (e.g. gnupg 17.4 needs matching gpgv 17.4) causing offline dpkg "dependency problems" when ISO baseline is older than noble-updates.
This commit is contained in:
@@ -307,9 +307,19 @@
|
||||
mode: '0777'
|
||||
|
||||
- name: "Deploy PPKG enrollment packages to enrollment share"
|
||||
shell: cp -f {{ usb_mount }}/enrollment/*.ppkg /srv/samba/enrollment/ 2>/dev/null || true
|
||||
args:
|
||||
warn: false
|
||||
shell: |
|
||||
set +e
|
||||
# Copy any whole PPKGs (small enough to fit on FAT32)
|
||||
cp -f {{ usb_root }}/enrollment/*.ppkg /srv/samba/enrollment/ 2>/dev/null
|
||||
# Reassemble any split files (foo.ppkg.part.00, .01, ... -> foo.ppkg)
|
||||
for first in {{ usb_root }}/enrollment/*.part.00; do
|
||||
[ -e "$first" ] || continue
|
||||
base="${first%.part.00}"
|
||||
name="$(basename "$base")"
|
||||
echo "Reassembling $name from chunks..."
|
||||
cat "${base}.part."* > "/srv/samba/enrollment/$name"
|
||||
done
|
||||
ls -lh /srv/samba/enrollment/*.ppkg 2>/dev/null
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Deploy run-enrollment.ps1 to enrollment share"
|
||||
@@ -320,16 +330,29 @@
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Deploy Dell driver packs to shared Out-of-box Drivers"
|
||||
shell: >
|
||||
if [ -d "{{ usb_mount }}/drivers" ]; then
|
||||
mkdir -p "/srv/samba/winpeapps/_shared/Out-of-box Drivers/Dell_11"
|
||||
cp -r {{ usb_mount }}/drivers/* "/srv/samba/winpeapps/_shared/Out-of-box Drivers/Dell_11/"
|
||||
echo "Deployed Dell drivers from USB"
|
||||
else
|
||||
echo "No drivers/ on USB - skipping"
|
||||
fi
|
||||
args:
|
||||
warn: false
|
||||
executable: /bin/bash
|
||||
shell: |
|
||||
set +e
|
||||
SRC="{{ usb_root }}/drivers"
|
||||
DEST="/srv/samba/winpeapps/_shared/Out-of-box Drivers/Dell_11"
|
||||
if [ ! -d "$SRC" ]; then
|
||||
echo "No drivers/ on USB - skipping"
|
||||
exit 0
|
||||
fi
|
||||
mkdir -p "$DEST"
|
||||
# Copy everything except split chunks
|
||||
rsync -a --exclude='*.part.*' "$SRC/" "$DEST/"
|
||||
# Reassemble any split driver files
|
||||
while IFS= read -r first; do
|
||||
base="${first%.part.00}"
|
||||
rel="${base#$SRC/}"
|
||||
out="$DEST/$rel"
|
||||
mkdir -p "$(dirname "$out")"
|
||||
echo "Reassembling $rel from chunks..."
|
||||
cat "${base}.part."* > "$out"
|
||||
done < <(find "$SRC" -name '*.part.00')
|
||||
echo "Deployed Dell drivers from USB"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Deploy shopfloor setup scripts to enrollment share"
|
||||
@@ -372,6 +395,17 @@
|
||||
- models.txt
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Deploy BIOS update binaries from USB"
|
||||
shell: >
|
||||
if [ -d "{{ usb_root }}/bios" ]; then
|
||||
cp -f {{ usb_root }}/bios/*.exe /srv/samba/enrollment/BIOS/ 2>/dev/null || true
|
||||
count=$(find /srv/samba/enrollment/BIOS -name '*.exe' | wc -l)
|
||||
echo "Deployed $count BIOS binaries"
|
||||
else
|
||||
echo "No bios/ on USB - skipping"
|
||||
fi
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Create image upload staging directory"
|
||||
file:
|
||||
path: /home/pxe/image-upload
|
||||
@@ -579,13 +613,24 @@
|
||||
# Boot Ubuntu kernel, download Blancco rootfs, overlay mount, switch_root.
|
||||
|
||||
- name: "Build Blancco PXE initramfs"
|
||||
args:
|
||||
executable: /bin/bash
|
||||
creates: "{{ web_root }}/blancco/kexec-initrd.img"
|
||||
shell: |
|
||||
set -e
|
||||
WORK=$(mktemp -d)
|
||||
mkdir -p "$WORK"/{bin,lib/modules,lib64,sbin,usr/share/udhcpc}
|
||||
|
||||
# Busybox (static)
|
||||
cp /bin/busybox "$WORK/bin/" 2>/dev/null || apt-get install -y busybox-static >/dev/null && cp /bin/busybox "$WORK/bin/"
|
||||
# Busybox (static) - bundled on USB at playbook/busybox-static
|
||||
if [ -f /bin/busybox ]; then
|
||||
cp /bin/busybox "$WORK/bin/"
|
||||
elif [ -f "{{ usb_root }}/playbook/busybox-static" ]; then
|
||||
cp "{{ usb_root }}/playbook/busybox-static" "$WORK/bin/busybox"
|
||||
chmod +x "$WORK/bin/busybox"
|
||||
else
|
||||
echo "ERROR: No busybox available (not at /bin/busybox or on USB)"
|
||||
exit 1
|
||||
fi
|
||||
for cmd in sh awk cat chmod echo grep gunzip ifconfig ip ln losetup ls mkdir mknod mount reboot route sed sleep switch_root tar udhcpc umount wget cpio; do
|
||||
ln -sf busybox "$WORK/bin/$cmd"
|
||||
done
|
||||
@@ -614,8 +659,7 @@
|
||||
find . | cpio -o -H newc 2>/dev/null | gzip > "{{ web_root }}/blancco/kexec-initrd.img"
|
||||
rm -rf "$WORK"
|
||||
echo "Built kexec-initrd.img: $(stat -c %s '{{ web_root }}/blancco/kexec-initrd.img') bytes"
|
||||
args:
|
||||
creates: "{{ web_root }}/blancco/kexec-initrd.img"
|
||||
ignore_errors: yes
|
||||
|
||||
- name: "Copy Ubuntu kernel for Blancco PXE boot"
|
||||
copy:
|
||||
@@ -648,12 +692,11 @@
|
||||
args:
|
||||
creates: "{{ web_root }}/blancco/config-clean.xml"
|
||||
|
||||
- name: "Create Samba user for Blancco reports"
|
||||
- name: "Ensure Samba user for Blancco reports exists (idempotent)"
|
||||
shell: |
|
||||
id blancco 2>/dev/null || useradd -r -s /usr/sbin/nologin blancco
|
||||
echo -e "blancco\nblancco" | smbpasswd -a -s blancco 2>/dev/null
|
||||
args:
|
||||
creates: /etc/samba/smbpasswd
|
||||
id blancco >/dev/null 2>&1 || useradd -r -s /usr/sbin/nologin blancco
|
||||
pdbedit -L 2>/dev/null | grep -q '^blancco:' || (echo -e "blancco\nblancco" | smbpasswd -a -s blancco)
|
||||
changed_when: false
|
||||
|
||||
- name: "Check for WinPE deployment content on USB"
|
||||
stat:
|
||||
|
||||
Reference in New Issue
Block a user