Reputation: 1107
Is there a way to specify a script as kernel parameter during pxe boot? I want run a bunch of computers as workers. I want them to use PXE to boot AlpineLinux and then run a bash script that will load my app and join my cluster.
Upvotes: 2
Views: 934
Reputation: 203
Change dir:
cd /tmp
Create directory structure:
.
└── etc
├── init.d
│ └── local.stop
└── runlevels
└── default
└── local.stop -> /etc/init.d/local.stop
mkdir -p ./etc/{init.d,runlevels/default}/
Create file ./etc/init.d/local.stop
:
#!/sbin/openrc-run
start () {
wget http://172.16.11.8/rickroll/video.mp4 -O /root/video.mp4
}
chmod +x ./etc/init.d/local.stop
cd /tmp/etc/runlevels/default
Make symlink:
ln -s /etc/init.d/local.stop local.stop
Go back:
cd /tmp
Create archive:
tar -czvf alpine-test-01.tar.gz ./etc/
Make pxelinux (on your tftp server) menu:
label insatll-alpine
menu label Install Alpine Linux [test]
kernel alpine-installer/boot/vmlinuz-lts
initrd alpine-installer/boot/initramfs-lts
append ip=dhcp alpine_repo=https://dl-cdn.alpinelinux.org/alpine/latest-stable/main modloop=https://dl-cdn.alpinelinux.org/alpine/latest-stable/releases/x86_64/netboot/modloop-lts modules=loop,squashfs,sd-mod,usb-storage apkovl=http://{YOUR_WEBSERVER}/{YOUR_DIR}/alpine-test-01.tar.gz
And run:
My webserver log:
10.10.15.43 172.16.11.8 - [27/Aug/2021:01:15:22 +0300] "GET /rickroll/video.mp4 HTTP/1.1" 200 5853379 "-" "Wget"
Upvotes: 1