In Cloud Director, when setting a customization script in a virtual machine, the script:
- Is called only on initial customization and force recustomization.
- Is called with the precustomization command line parameter before out-of-box customization begins.
- Is called with the postcustomization command line parameter after out-of-box customization finishes.
- Needs to be a batch file for Windows virtual machines and a shell script for Unix virtual machines.
Here are sample customization scripts for Windows and Unix and Linux virtual machines:
Windows sample batch file
@echo off
if "%1%" == "precustomization" (
echo Do precustomization tasks
) else if "%1%" == "postcustomization" (
echo Do postcustomization tasks
)
A Unix sample shell script
#!/bin/sh
if [ x$1 == x"precustomization" ]; then
echo Do Precustomization tasks
elif [ x$1 == x"postcustomization" ]; then
echo Do Postcustomization tasks
fi
Note: The length of customization script cannot be greater than 1500 characters.
A Linux sample shell script
#!/bin/sh
if [ x$1 == x"precustomization" ]; then
echo Do Precustomization tasks
elif [ x$1 == x"postcustomization" ]; then
echo Do Postcustomization tasks
fi
Note: "=" instead of "==" format works in most flavors of Linux. This format has been tested with SLES, RHEL, Ubuntu etc.