Novell is now a part of Micro Focus

Disabling the ZENworks Partition Creation Menu and Enabling a Custom Imaging Script in ZENworks 7 SP1 HP5.

Novell Cool Solutions: Feature
By Bobby Guillory

Digg This - Slashdot This

Posted: 17 Jul 2007

ZENworks Desktop Management 7 SP1
ZENworks 7 Desktop Management Service Pack 1 Hot Patch 5

This article will show you how to disable the call to the ZENworks Partition creation menu and how to call your custom imaging script with the new ZENworks Imaging Resource Files. Some of the resources used in this paper are from Novell ZENworks 7 Desktop Management documentation files.

Since some companies, like mine, do not use the ZENworks partition, this seemed to me like the most logical step to consider. There should be no reason to answer configuration questions for a task that will not be used. The following steps will be done in order to accomplish the tasks needed to fulfill the requirements for this article.

  1. Opening and extracting the Linux kernel for modification.
  2. Disabling the call for the ZENworks Partition creation menu when auto imaging.
  3. Disabling the call for the ZENworks Partition creation menu for the bash prompt.
  4. Compressing and preparing the Linux kernel for production.
  5. Calling the custom imaging script for auto imaging.


The PXE environment, created by the updated imaging resource files, calls a creation menu for the ZENworks partition. This menu allows the user to answer specific questions to configure a customized ZENworks partition for the specific imaging process. The menu imports information from the settings.txt and uses it as the default settings for the menu. The user is prompted to accept the defaults or enter in new information.

Here is an example of the menu:

This process is used to update the ZENworks Partition settings.
This computer does not contain a ZENworks Partition.
Press Enter...
Please enter size of ZENworks partition in MB (size >=150) [150]:
Do you want to use dhcp (y/n) [y]:
If you have multiple network devices you may want to enter which one to use. Normally, with multiple cards, the network device will be eth0.
Do not set 'netdevice' if you want to use the default, detected network device.
Network device already set to (eth0), delete setting? (y/n) [N]
Please enter which network device to use [eth0]
Please enter Proxy address (dns or ip address) [192.168.*.*]:
You may set IMGCMD to run automatically in place of the normal auto imaging.
You may enter the command to run.
Please enter the IMGCMD line to use [bash -c script.s]
Do you want to set up the workstation to reboot manually (y/n) [n]:
Do you want to store configuration parameters to ZENworks Partition (y/n) [n]

This is the menu that will have to be disabled.

The first recommended course of action is to read the documentation and follow the directions, which Novell gives in its ZENworks 7 Desktop Management Documentation, in regards to modifying ZENworks imaging resource files.

Since I do not like to modify original files, here is what I would do:

  1. Create a working directory or change to an existing directory (ex. /usr/local/src)
  2. Copy /srv/tftp/boot/initrd to the just created directory.
  3. Copy /srv/tftp/boot/initrd to /srv/tftp/boot/initrd.old
  4. Change back to the newly created working directory
  5. Move initrd to a temporary gzipped file. (mv initrd initrd.gz)
  6. Decompress the .gz file (gzip -d initrd.gz). This changes the initrd.gz file back to an uncompressed initrd file.
  7. Create a directory called boot. (mkdir boot).
  8. Change to the new directory and run the command to extract the archive to the current directory (cpio -idmuv < ../initrd)

What we now have is the ability to modify the Linux kernel that is used by the PXE of the imaging server. The next thing to do is to enter into the directory where the imaging script files are contained by ZENworks. Following the directions above, we will need to enter the bin directory of the extracted kernel by running the command: "cd bin". (ex. cd /usr/local/src/boot/bin)

You should now see the directory that contains the scripts that are run by ZDM PXE.

The files that we want to concentrate on are zenworks.s, config.s, imaging.s, and prompt.s. These files are what can be considered the primary scripts that are used by the PXE environment in ZDM.

Type in the command "less zenworks.s" (no quotes). This will open the zenworks.s script and provide you with insight on what is being called by ZENworks upon boot. What we are concerned with lies at the bottom of the script. Click on the space bar or the pgdn key until you reach the bottom of the script. There you will find the scripts that are called assuming your choice within the PXE menu at boot.

/bin/version.s > /dev/tty3
echo "***************************************************************" >/dev/tt

if [ $mode = '2' ] ; then
    # auto (2)
    /bin/bash -rcfile /bin/bashrc -c "/bin/imaging.s boot"
elif [ $mode = '3' ] ; then
    # lilo (3) - enable - disable
    /bin/bash -rcfile /bin/bashrc -c "/bin/lilo.s boot"
elif [ $mode = '5' ] ; then
    # manual (5)
    /bin/bash -rcfile /bin/bashrc -c "/bin/prompt.s boot"
elif  [ $mode = '4' ] ; then
    # install (4)
    /bin/bash -rcfile /bin/bashrc -c "/bin/install.s boot"
    # config (7)
    /bin/bash -rcfile /bin/bashrc -c "/bin/config.s boot"

/bin/bash -rcfile /bin/bashrc

As you can see the imaging.s script is called when auto imaging is selected. When manual imaging is selected, the prompt.s script is called. This script will give you the bash shell prompt after boot. Since these two scripts are the most commonly used I will concentrate on these only.

We will now disable the need to create the ZENworks partition during the auto imaging process.

First we need to edit the imaging.s script.

# imaging.s

#. /bin/config.s auto
#check for environment variable with command to run
if [ "a0" = "a"${#IMGCMD} ] ; then
        /bin/img a

        #Return codes for img:
        #       0       SUCCESSFUL, but no changes on hard drive(s)
        #       1       SUCCESSFUL, new image placed on hard drive(s)
        #       2       SUCCESSFUL, proxy had no work to be done
        #       4       SUCCESSFUL, advanced script brought down to be run
        if test -f "$IMGCMD" ; then
                # if the file is a regular file, assume it is a script and in u
                /usr/bin/dos2unix $IMGCMD
                /bin/chmod +x $IMGCMD
  1. Use vi or favorite editor and open the imaging.s script
  2. Comment out the line for . /bin/config.s auto
  3. Comment out the line for mounting the floppy.
  4. Close and save changes.

This stops the ZENworks partition from trying to auto create itself during the auto imaging process and leaves the door open to setup the customized imaging script without any problems. I found that I could not correctly call my imaging script with the ZENworks partition enabled. The script would give me different line errors on the script code and then reboot or simply hang until I did a hard boot on the machine.

We will now do the same thing for the prompt.s script which is used when using the manual imaging process.

  1. Use vi or favorite editor and open the prompt.s script
  2. Comment out the line for . /bin/config.s auto
  3. Comment out the line for mounting the floppy. (Do not comment out the If statement.)
  4. Close and save changes.
# prompt.s
#. /bin/config.s manual
if [ $? != 0 ]; then echo "Failed to mount floppy drive. If there is a floppy in the drive, remove it before running img"; fi

/bin/bash -rcfile /bin/bashrc

The reason the If statement is not commented out is that the script will not work correctly without it. The machine will hang if the If statement is commented out which does not make sense since the statement is technically only performing a check but I will have to look a little further into this when time permits.

The config.s script is the script that is used to call the the ZENworks Partition creation menu. The script gets its parameters from the settings.txt file located at /srv/tftp/boot directory and by user input. The setup is similar to the one used by the boot cd that is available in the previous versions of ZDM. Thus, by commenting out the call for the script we technically disable the creation of the ZENworks partition.

Now, one may ask why do you not choose the option to not create the ZENworks partition? That option was chosen but you are still taken through the menu to create the partition and at the end you have an option on whether to save the partition or not. So basically I'm just taking out the middle man.

The next task to complete would be to create your custom imaging script file. The file can call for a single image, multicast imaging, dual boot images, etc. I found that it is easier if the script is placed in the bin directory of the working directory that you are using (ex. /usr/local/src/boot/bin) since this is where most of the other script files are being called.

The next task for us to complete is to compress the file and move it back to its original boot directory. We accomplish this by again using the method described in the ZENworks 7 Desktop Management documentation.

  1. Recreate the archive with the new and modified files. (find . | cpio -o -H newc > ../initrd).
  2. Change to the previous directory ( cd ..)
  3. Change the initrd back to its compressed state. (gzip -v9 initrd)
  4. Rename the compressed file to its original name. (mv initrd.gz initrd)
  5. Copy file back to the /srv/tftp/boot directory (cp initrd /srv/tftp/boot)

Finally we need to call the specific imaging script(s) that will be used in the custom imaging environment. This can be done through a simple modification of the settings.txt file that is located at /srv/tftp/boot directory.

  1. Change working directory to /srv/tftp/boot. (cd /srv/tftp/boot).
  2. Make a backup of settings.txt (cp settings.txt settings.bak)
  3. Open settings.txt with your favorite editor. (vi settings.txt).
  4. Add the script(s) in the IMGCMD location. (export IMGCMD="bash -c script")

    #Use IMGCMD to alter the behavior of automated imaging.  If this variable is defined
    #as a script (or a series of commands), then that script (or those commands) will be
    #executed instead of the usual 'img auto' command (see /bin/imaging.s).
    #export IMGCMD="bash -c cdrom.s; img rl /mnt/cdrom/linux.zmg"
    export IMGCMD="bash -c image.s"
  5. Save and exit editor.


Once the settings.txt file is saved, the PXE environment is ready with the updated imaging resource files. There will no longer be any calls for the ZENworks Partition creation menu and any scripts that were created and used with the previous versions of ZENworks can also be called at this time for work without any issues. Testing is always recommended to make sure scripts are working as projected.

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions.

© Copyright Micro Focus or one of its affiliates