Script to create a custom VIB in ESXi 5.0

This script can be used to maintain a list of files to mount automatically at boot time. The list of files must also include the parent directories, if those are not present in the default directory hierarchy.

/createcustom.sh:

#!/bin/sh
# /createcustom.sh
# Chris Wells 20120602
# Put the list of files to include in file /customfiles
# Then add “— custom.v00” to the boot options in /bootbank/boot.cfg
# Test it by:
# vmkramdisk /bootbank/custom.v00

cd /
tar cvf /tmp/custom.tar `cat /customfiles` createcustom.sh customfiles
vmtar -o /tmp/custom.vmtar -c /tmp/custom.tar
rm -f /tmp/custom.tar
gzip -9 < /tmp/custom.vmtar > /tmp/custom.v00
rm -f /tmp/custom.vmtar
cp /tmp/custom.v00 /bootbank
rm -f /tmp/custom.v00

eg, I’ve used this to create ssh keys for a non-root user:

~ # /createcustom.sh 
etc/security/access.conf
etc/ssh/keys-foo/
etc/ssh/keys-foo/authorized_keys
createcustom.sh
customfiles
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: