Knowledge Base Glossary       Exit
(how to) Search  

Browse by Category
Knowledge Base > Products > Image for Linux > FAQ > How to add user-created scripts to the IFL Boot Disk

How to add user-created scripts to the IFL Boot Disk

The IFL Boot Disk supports adding user-created scripts to the disk for the purpose of automating IFL backup and restore operations. Starting with IFL 2.84, tbosdt scripts (.tbs and .run scripts) are also supported, in addition to Linux shell scripts.

Adding scripts to the boot disk requires creating a custom version of the IFL Boot Disk containing one or more scripts. A custom IFL Boot Disk containing user-created scripts can be created using one of the methods outlined in the following section:

Methods of Creating a Custom IFL Boot Disk

1. From Windows using Makedisk: As of IFL 2.84, Makedisk provides the option of including and configuring user scripts when creating custom IFL boot media from the Windows environment. For additional information, please see the "Boot Option - Scripting" section in the IFL User Manual, starting on page 22.

2. From a Linux distribution: Use this tutorial to create a custom IFL Boot Disk from an installed Linux distribution. Then see the "Configuring User Scripts From Linux" section below for information on how to set up and configure scripts on the boot disk. Either method of configuring scripts described in that section can be used, depending on the IFL version.

3. From the running IFL Boot Disk (IFL version 2.62 or later): This is essentially the same as method 2 above, except that it is done from the running boot disk, rather than from an installed Linux distribution. Refer to this KB article for details on how to do it. Then see the "Configuring User Scripts From Linux" section below for information on how to set up and configure scripts on the boot disk. Either method of configuring scripts described in that section can be used, depending on the IFL version.

4. From Windows using BootFile: Use this tutorial to create a custom IFL Boot Disk that uses the TeraByte utility BootFile to boot into IFL directly from within Windows. See Steps 7 and 8 in the Getting Set Up section for information specific to adding scripts. Then see the "Configuring User Shell Scripts" section below to configure the scripts. Note that the BootFile method requires using the RUNSCRIPTS method of configuring scripts.

Configuring User Scripts From Linux

There are 2 methods described below to configure user scripts on the IFL Boot Disk. Some may prefer the newer, menu-driven method (1). However, the older RUNSCRIPTS method (2) will continue to be supported for those who prefer to use it. The following information is common to both configuration methods:

1. The scripts directory (within the extracted IFL directory) must be populated with one or more scripts that you want to have available on the boot disk.These scripts will appear in the /tbu/scripts directory on the running boot disk.

2. By default, none of the scripts will run automatically on boot. However, all of them will be available to run manually.

3. It is not necessary to set permissions or ownership on any of the shell scripts. That will be taken care of automatically when the boot disk is created.

1. Newer menu-driven method (IFL 2.83 and later)

Starting with IFL version 2.83, user scripts can be configured from the IFL Boot Media Settings menu that is common to all of the Linux make* scripts (makeHDD, makeISO, makeGRUB, makePXE). On that menu, select  the "Configure User Scripts" item, which has the following options available:

Normal boot (no scripts will run): This is the default setting. No scripts will be executed automatically, but all scripts (if any) will be available to run manually,  and will also be available by selecting "Display User Scripts Menu" from the desktop menu (GUI), or the Auxiliary menu (CUI).

Select a script to run on boot: This item will display a menu from which you can select one of the scripts in the scripts directory to execute on boot. The remaining scripts (if any) will be available to run manually.

Run all scripts in scripts directory on boot: This item will cause all scripts in the scripts directory to execute sequentially on boot. The scripts will be executed in the following order:  numeric, upper case, lower case. If an exact order of execution is needed, the scriptslist.txt method (see below) is the most straight forward way to do it.

Run scripts in scriptslist.txt on boot (IFL 2.84 and later): This item will execute the script(s) listed in the file scriptslist.txt (located in the scripts directory). The scripts will execute in the order listed in the file.

Display a menu of all scripts on boot: This item will display a menu of all scripts in the scripts directory on boot. Each script can be executed by selecting it from the menu.

2. Older RUNSCRIPTS method (all IFL versions)

With all versions of IFL, you can specify one or more scripts to execute automatically on boot, by editing and uncommenting the RUNSCRIPTS option in config.txt (ifl_boot.cfg for the BootFile method). The config.txt file is located in the extracted IFL directory. By default, the RUNSCRIPTS option will be commented out and will have no effect.

To specify that one or more scripts be executed automatically on boot, uncomment the RUNSCRIPTS line (remove the "#" at the beginning), and type in the name(s) of the script(s) to be executed. If more than one script is to be executed, the script names must be separated by a space inside the parenthesis. The scripts will be executed in the order they are listed. The following examples illustrate what the RUNSCRIPTS line should look like to execute 1, 2, or 3 scripts respectively:

     RUNSCRIPTS=(script1)

     RUNSCRIPTS=(script1 script2)

     RUNSCRIPTS=(script1 script2 script3)

Remember to uncomment the RUNSCRIPTS line when finished editing it, or none of the scripts specified will execute. Comment the line out again to disable it.

Additional note: In IFL versions 2.83 and later, any script(s) or menu specified with the newer method described above will override the RUNSCRIPTS method. In other words, the "Configure User Scripts" menu item must be set to the default of "Normal boot" in order for the RUNSCRIPTS option to work.

Template Scripts and Additional Information

1. Backup or Restore To/From Network Shares: The downloadable ifl-smb.zip archive contains a template script that is suitable for adding to the IFL Boot Disk, or can also be used as an example to write your own. The script can be configured to mount an SMB network share (Windows/Samba), and then do one or more backup or restore operations to/from the share. The script includes a self-documented configuration section near the beginning which must be edited with the appropriate parameters. The zip archive also includes a readme.txt file that further explains how to use the script.

http://www.terabyteunlimited.com/downloads/wp/ifl-smb.zip

2. Embedding the date and time in an image filename: As noted in the IFL manual (page 62), the date and time can be included in an image filename by using a special set of variables, as defined in the manual. Doing this on a command line in a script will result in an error condition unless each "$" character is preceded with a backslash "\" character. The following is an example path/filename (year, month, day, and time) with the required backslashes added:

"--f:$mountpoint/path/myimage_\$~YYYY\$-\$~MM\$-\$~DD\$-\$~HHMM\$"

3. BASH Scripts Beginner's Guide:

 http://tldp.org/LDP/Bash-Beginners-Guide/html/index.html


How helpful was this article to you?


powered by Lore