Skip to content

Commit a99ddc1

Browse files
committed
add patch-alpine-netboot-image-with-zfs.sh PatchFile-init-ping
1 parent 300c522 commit a99ddc1

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

PatchFile-init-ping

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- init.old 2023-09-04 13:51:43.491748438 +0100
2+
+++ init 2023-09-04 13:53:02.331764604 +0100
3+
@@ -219,6 +219,21 @@
4+
if ifconfig "$device" "$client_ip" netmask "$netmask"; then
5+
[ -z "$gw_ip" ] || ip route add 0.0.0.0/0 via "$gw_ip" dev "$device"
6+
fi
7+
+
8+
+ while true; do
9+
+ ping -c 1 -w 1 8.8.8.8
10+
+ if [ $? -eq 0 ]; then
11+
+ echo "Ping successful!"
12+
+ break
13+
+ else
14+
+ echo "Ping failed. Retrying..."
15+
+ sleep 1
16+
+ fi
17+
+ done
18+
+
19+
+ echo Hard coding DNS entry
20+
+ echo "nameserver 8.8.8.8" >> /etc/resolv.conf
21+
+
22+
eend $?
23+
fi
24+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
3+
# Purpose: Patch alpine netboot image with
4+
# - include zfs kernel module by default
5+
# (note the 'alpine extended iso' includes the zfs module
6+
# but that is not a netboot image)
7+
# - ping delay wait until network links are up and can
8+
# reach gateway
9+
#
10+
11+
set -x
12+
13+
# Force a wait for interfaces to come up
14+
# on slow switches
15+
16+
tar -xvf alpine-netboot-*.tar.gz
17+
18+
WORK_DIR=$PWD
19+
cd iso/boot
20+
21+
mkdir patch
22+
23+
zcat initramfs-lts | cpio -D patch --extract --make-directories --preserve-modification-time
24+
25+
cd patch
26+
27+
# Apply the initramfs-lts patch
28+
patch init ../../../PatchFile-init-ping
29+
30+
# Re-package initramfs-lts
31+
find . | cpio --format=newc --create | gzip > initramfs-lts
32+
mv initramfs-lts ../
33+
34+
cd ../
35+
rm -rf patch
36+
37+
# Re-tar the netbook image for sending to boot server
38+
tar -cvf alpine-netboot-zfs.tar.gz ./
39+
40+
cd $WORK_DIR

0 commit comments

Comments
 (0)