Skip to content

Instantly share code, notes, and snippets.

@BlackMaria
Created May 24, 2013 19:39
Show Gist options
  • Save BlackMaria/5645992 to your computer and use it in GitHub Desktop.
Save BlackMaria/5645992 to your computer and use it in GitHub Desktop.
This is an example of how I start to create a new stateless image
#!/bin/sh
# CREATE XCAT STATLESS IMAGE
# -- note you can not make a statless image for a distro other than the one this script is running on
# -- That is various tools will fail if you try to build fedora on centos, or centos6.1 on centos6.4
#
# Setup DISTRO Variables
DIST=`lsb_release -i | cut -d: -f2 | sed 's/\s//g' `
REL=`lsb_release -r | cut -d: -f2 | sed 's/\s//g' `
MAJ=`echo $REL | cut -d. -f1 | sed 's/\s//g' `
release=rh$MAJ
ARCH=` uname -m`
DISTRO=$DIST$REL
DISTRO_LC=`echo $DIST$REL | tr '[A-Z]' '[a-z]'`
ISO_DISTRO=$DIST-$REL
ISO_ARCH=$ARCH
DISTRO_VERS=$REL
HEADNODE_NAME=xcat
DOMAIN=cluster.example.com
NODE_TYPE=baseimage
INST_ROOT="/install/netboot/${DISTRO_LC}/${ARCH}/${NODE_TYPE}/rootimg"
# Run genimage to make chrooted OS in $INST_ROOT
cd /install/custom/netboot/centos/
./genimage -i eth0 -n tg3,bnx2 -o ${DISTRO_LC} -p ${NODE_TYPE}
# do some majik here
# add any customization you want on the image here
# example
# install -m 600 /root/file $INST_ROOT/root/file
#
# Create the initrd image
packimage -p ${NODE_TYPE} -a ${ARCH} -o ${DISTRO_LC}
# Configure node to boot from this statless image
nodeset nodename osimage=${DISTRO_LC}-${ARCH}-netboot-${NODE_TYPE}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment