An example Plan Script

This example Plan Script explains some sample guestfish commands and their syntax.

# Example Image Streamer Plan Script

A line starting with # is considered as a comment in Plan Script.

!echo "File Systems in Golden Image:”

This command executes a bash command on the Image Streamer appliance. In this example, the output of the echo command is captured in the deployment log. The deployment log can be used to monitor the execution of Plan Script and for debugging errors.

list-filesystems

This is a guestfish command to list the file systems in the OS volume.

list-partitions

This is a guestfish command to list the partitions in the OS volume.

!echo "Mounting File Systems:"
mount /dev/sda1 /

This command mounts the partition /dev/sda1 to a pseudo root directory /. After this command is executed, the contents of the partition can be accessed using /. For example: /tmp/example.sh.

!echo "Personalize message.txt content:"
upload -<<EOF /tmp/example.sh
#!/bin/bash
echo “OS name and version”
uname -r
echo “Example attributes and values:”    
echo “@ExampleString:Hello World!@”   
echo “@ExampleNumber:50@”    
EOF

This command sequence shows how heredoc syntax can be used to insert a bash script into the operating system. If this example is executed, the contents of the Plan Script between the EOF markers are placed in the /tmp/example.sh file in the operating system image. This command sequence also shows the usage of custom attributes ExampleString and ExampleNumber with default values.

umount

This command unmounts the partition after personalization is complete.

Plan Script example with system attributes

The following lines show how to use system attributes in Plan Scripts, to access the target OS volume details.
echo "Target volume device name to mount :@_Target.dev@"
echo "Target name/iqn:@_Target.name@"
echo "Target IP address:@_Target.ip@"
echo "Target port:@_Target.port@ , Target LUN:@_Target.lun@"
The following lines show how to use system attributes in Plan Scripts, to display deployment connection 1 details.
echo "Initiator-1 MAC:@_Initiator1.mac@"
echo "Initiator-1 name :@_Initiator1.name@"
echo "Initiator-1 IP address:@_Initiator1.ip@ , Initiator-1 netmask:@_Initiator1.netmask@"
echo "Initiator-1 gateway:@_Initiator1.gateway@"
The following lines show how to use system attributes in Plan Scripts, to display deployment connection 2 details.
echo "Initiator-2 MAC:@_Initiator2.mac@"
echo "Initiator-2 name :@_Initiator2.name@"
echo "Initiator-2 IP address:@_Initiator2.ip@ , Initiator-2 netmask:@_Initiator2.netmask@"
echo "Initiator-2 gateway:@_Initiator2.gateway@"