Skip to content

Commit

Permalink
#20 tidy up init netboot patching tar between runs
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsimpson committed Nov 23, 2024
1 parent 08ddf9f commit 1cc43d5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
7 changes: 4 additions & 3 deletions build-alpine-netboot-zfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
# Build netboot image with zfs kernel module included

# USAGE:

# podman run -it --rm -v $(pwd)/scratch:/root/workdir alpine sh /root/workdir/build-alpine-netboot-zfs.sh
# podman run -it --rm -v $(pwd):/root/workdir alpine sh /root/workdir/build-alpine-netboot-zfs.sh


set -x

apk add alpine-sdk build-base apk-tools busybox fakeroot syslinux xorriso squashfs-tools sudo git grub grub-efi

# Note we build alpine-conf from source due to issue https://github.com/KarmaComputing/server-bootstrap/issues/20
# Note we now build alpine-conf from source (rather than doing apk add alpine-conf)
# due to issue https://github.com/KarmaComputing/server-bootstrap/issues/20

# Clone and build latest alpine-conf
git clone https://gitlab.alpinelinux.org/alpine/alpine-conf.git
cd alpine-conf
Expand Down
20 changes: 17 additions & 3 deletions patch-alpine-netboot-image-with-zfs.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash

# Purpose: Patch alpine netboot image with
# - include zfs kernel module by default
Expand All @@ -10,13 +10,23 @@

set -x


# Force a wait for interfaces to come up
# on slow switches

WORK_DIR=$PWD
NETBOOT_OUTPUT_FILENAME=alpine-zfsnetboot-patched-init.tar.gz
pwd
ls -lh
cd iso
echo Removing previously extracted ./boot if exists
rm -rf ./boot
echo "Removing previous $NETBOOT_OUTPUT_FILENAME if exists"
rm -rf $NETBOOT_OUTPUT_FILENAME
# Clean up previous runs
find . -maxdepth 1 -type f -name "*.tar.gz" -mtime +0 # Remove older than today


tar -xvf alpine-zfsnetboot-*.tar.gz
cd ./boot

Expand All @@ -36,6 +46,10 @@ mv initramfs-lts ../
cd ../
rm -rf patch

# Re-tar the netbook image for sending to boot server
tar -cvf alpine-zfsnetboot.tar.gz ./
echo Re-taring the netbook image for sending to boot server
echo -n patched-init makes reference to the fact init will poll ping to verify network
echo is up before attempting to pull down additional packages over network

tar -cvf $NETBOOT_OUTPUT_FILENAME ./
mv $NETBOOT_OUTPUT_FILENAME ../
cd $WORK_DIR

0 comments on commit 1cc43d5

Please sign in to comment.