Skip to content

Instantly share code, notes, and snippets.

@furlongm
Created December 13, 2019 20:19
Show Gist options
  • Save furlongm/1b6666a60deaf07146203afd911fcbba to your computer and use it in GitHub Desktop.
Save furlongm/1b6666a60deaf07146203afd911fcbba to your computer and use it in GitHub Desktop.
#!/bin/bash
# To install systemrescuecd on PXE:
# change the version number
version=3.2.0
wget -c http://aarnet.dl.sourceforge.net/project/systemrescuecd/sysresccd-x86/$version/systemrescuecd-x86-$version.iso
# mount the cdrom image:
mount -o loop systemrescuecd-x86-${version}.iso cd
# create a version dir:
mkdir -p ${version}/pxelinux.cfg
# copy the required files off the cd:
cp -a cd/bootprog ${version}
cp -a cd/bootdisk ${version}
cp -a cd/ntpasswd ${version}
cp -a cd/isolinux/* ${version}
# copy the isolinux.cfg to the pxe directory:
cp -a ${version}/isolinux.cfg ${version}/pxelinux.cfg/default
# copy the actual system files to a netbootable area:
cp -a cd/sysrcd.md5 /var/www/default/
cp -a cd/sysrcd.dat /var/www/default/
# edit the default option to include http netboot, except for root=auto and maps entries
sed -i -e "s/\(APPEND .*\)/\1 dodhcp netboot=http:\/\/172.31.4.254\/sysrcd.dat/g" ${version}/pxelinux.cfg/default
sed -i -e "s/\(APPEND .*\) -- \(.*\)/\1 dodhcp netboot=http:\/\/172.31.4.254\/sysrcd.dat -- \2/g" ${version}/pxelinux.cfg/default
sed -i -e "s/\(APPEND root=auto\).*/\1/g" ${version}/pxelinux.cfg/default
sed -i -e "s/\(APPEND maps.*\) dodhcp.*/\1/g" ${version}/pxelinux.cfg/default
sed -i -e "s/APPEND rescue64 root=auto dodhcp netboot=http:\/\/172.31.4.254\/sysrcd.dat -- rescue32 root=auto dodhcp netboot=http:\/\/172.31.4.254\/sysrcd.dat/APPEND rescue64 root=auto -- rescue32 root=auto/g" ${version}/pxelinux.cfg/default
# umount cdrom image
umount cd
# You also need to do the following
echo "Make sure an entry similar to the following exists in the pxe root"
echo
echo "LABEL rescuecd"
echo " kernel pxechain.com"
echo " append ::systemrescuecd/${version}/pxelinux.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment